教程集 www.jiaochengji.com
教程集 >  Python编程  >  Python入门  >  正文 Python pip(管理模块工具)基础用法

Python pip(管理模块工具)基础用法

发布时间:2021-12-19   编辑:jiaochengji.com
教程集为您提供Python pip(管理模块工具)基础用法等资源,欢迎您收藏本站,我们将为您提供最新的Python pip(管理模块工具)基础用法资源

Python 自带了一个 pip 工具用来查看、管理所安装的各种模块。

查看已安装的模块

查看已安装的模块,使用如下命令:

<pre class="brush:html;toolbar:false">pip show packagename</pre>

启动命令行窗口,在窗口中输入如下命令:

<pre class="brush:html;toolbar:false">pip show mysql-connector-python</pre>

在上面的命令中,mysql-connector-python 就是该模块的名字。运行该命令,可以看到如下输出结果:

<pre class="brush:html;toolbar:false">Name: mysql-connector-python Version: 8.0.11 Summary: MySQL driver written in Python Home-page: http://dev.mysql.com/doc/connector-python/en/index.html Author: Oracle and/or its affiliates Author-email: UNKNOWN License: GNU GPLv2 (with FOSS License Exception) Location: d:\python\python36\lib\site-packages Requires: protobuf Required-by:</pre>

<span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">从上面的输出结果可以看到,已经成功安装了 mysql-connector-python 8.0.11,以及该模块的官方网址和安装路径等有用的信息。</span>

卸载己安装的模块

卸载己安装的模块,使用如下命令:

<pre class="brush:html;toolbar:false">pip uninstall packagename</pre>

<span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">在命令行窗口中输入如下命令:</span>

<pre class="brush:html;toolbar:false">pip uninstall mysql-connector-python</pre>

运行该命令,可以看到如下输出结果:<span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"></span>

<pre class="brush:html;toolbar:false">Uninstalling mysql-connector-python 8.0.11:   Would remove:     d:\python\python36\lib\site-packages\mysql     d:\python\python36\lib\site-packages\mysql_connector_python-8.0.11-py3.6.egg-info     d:\python\python36\lib\site-packages\mysqlx Proceed (y/n)?</pre>

上面的提示信息询问是否要删除 mysql-connector-python 模块,如果删除该模块,将会删除 3 个目录。如果希望删除,则可以在输入“y”之后按回车键。接下来将看到系统提示如下信息:

<pre class="brush:html;toolbar:false">Successfully uninstalled mysql connector-python-8.0.11</pre>

<span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">

该信息显示 mysql-connector-python-8.0.11 被删除成功。

执行该删除命令后,Python 将不再包含 mysql-connector-python 模块,相当于在安装 MySQL 服务器时没有选择 Connector/Python 模块。

如果要查看已安装的所有模块,可以使用如下命令:

<pre class="brush:html;toolbar:false">pip list</pre>

安装模块

安装模块,使用如下命令:

<pre class="brush:html;toolbar:false">pip install packagename</pre>

在命令行窗口中输入如下命令:

</span><span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"><pre class="brush:html;toolbar:false">pip install mysql-connectar-python</pre></span>

<span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);">运行该命令,将看到程序下载并安装 mysql-connector-python 模块的过程,最后会生成如下提示信息:</span>

<pre class="brush:html;toolbar:false">Successfully installed mysql-connector-python-8.0.11</pre>

<span style="color: rgb(68, 68, 68); font-family: "Helvetica Neue", 微软雅黑, "Microsoft Yahei", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"></span>

您可能感兴趣的文章:
Python pip(管理模块工具)基础用法
详解Python中的包和包管理工具
python library怎么安装
python工程师需要会什么
python怎么查看安装的模块有哪些
python怎么卸载pip
python怎么下载pip
flask框架难吗
python pip怎么用
python rsa如何安装

[关闭]
~ ~