Python pip 常用命令汇总

 更新时间:2020年10月19日 11:07:06   作者:Blue·Sky  
这篇文章主要介绍了Python pip 常用命令汇总,帮助大家更好的理解和使用pip命令,感兴趣的朋友可以了解下

使用了这么就pip命令,但是一直是简单使用,很多命令都是用了查,查了用,今天把常用的命令汇总一下,方便使用。

命令:

pip

由上图可以看到 pip 支持一下命令

Commands:
 install           Install packages.
 download          Download packages.
 uninstall          Uninstall packages.
 freeze           Output installed packages in requirements format.
 list            List installed packages.
 show            Show information about installed packages.
 check            Verify installed packages have compatible dependencies.
 search           Search PyPI for packages.
 wheel            Build wheels from your requirements.
 hash            Compute hashes of package archives.
 completion         A helper command used for command completion.
 help            Show help for commands.
General Options:
 -h, --help         Show help.
 --isolated         Run pip in an isolated mode, ignoring
               environment variables and user configuration.
 -v, --verbose        Give more output. Option is additive, and can be
               used up to 3 times.
 -V, --version        Show version and exit.
 -q, --quiet         Give less output. Option is additive, and can be
               used up to 3 times (corresponding to WARNING,
               ERROR, and CRITICAL logging levels).
 --log <path>        Path to a verbose appending log.
 --proxy <proxy>       Specify a proxy in the form
               [user:passwd@]proxy.server:port.
 --retries <retries>     Maximum number of retries each connection should
               attempt (default 5 times).
 --timeout <sec>       Set the socket timeout (default 15 seconds).
 --exists-action <action>  Default action when a path already exists:
               (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
 --trusted-host <hostname>  Mark this host as trusted, even though it does
               not have valid or any HTTPS.
 --cert <path>        Path to alternate CA bundle.
 --client-cert <path>    Path to SSL client certificate, a single file
               containing the private key and the certificate
               in PEM format.
 --cache-dir <dir>      Store the cache data in <dir>.
 --no-cache-dir       Disable the cache.
 --disable-pip-version-check
               Don't periodically check PyPI to determine
               whether a new version of pip is available for
               download. Implied with --no-index.

1、install

pip install
You must give at least one requirement to install (see "pip help install")

所以这里可以直接使用一下命令实现在线安装

pip install <包名> 或 pip install -r requirements.txt
通过使用== >= <= > <来指定版本,不写则安装最新版

requirements.txt内容格式为:

APScheduler==2.1.2
Django==1.5.4
MySQL-Connector-Python==2.0.1
MySQL-python==1.2.3
PIL==1.1.7
South==1.0.2
django-grappelli==2.6.3
django-pagination==1.0.7

安装本地安装包

pip install <目录>/<文件名> 或 pip install --use-wheel --no-index --find-links=wheelhouse/ <包名>

2、uninstall

卸载安装包

pip uninstall <包名> 或 pip uninstall -r requirements.txt

升级包

pip install -U <包名>

或:pip install <包名> --upgrade

升级pip

pip install -U pip

使用pip安装插件的时候报错:

You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

升级命令: python -m pip install --upgrade pip

3、freeze

pip freeze,查看已经安装的包及版本信息。

导出到指定文件中,如图,注意 “ > ”,文件名称随意。常见按第二种写法。

4、list

查询可升级的包

pip list -o

5、show

显示包所在目录及信息

6、search

搜索包

pip search <搜索关键字>

以上就是Python pip 常用命令汇总的详细内容,更多关于Python pip 常用命令的资料请关注脚本之家其它相关文章!

相关文章

  • Python filter()及reduce()函数使用方法解析

    Python filter()及reduce()函数使用方法解析

    这篇文章主要介绍了Python filter()及reduce()函数使用方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-09-09
  • python去除字符串中的空格、特殊字符和指定字符的三种方法

    python去除字符串中的空格、特殊字符和指定字符的三种方法

    本文主要介绍了python去除字符串中的空格、特殊字符和指定字符的三种方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2023-02-02
  • 关于Python排序sort()函数和sorted()函数

    关于Python排序sort()函数和sorted()函数

    这篇文章主要介绍了关于Python排序sort()函数和sorted()函数,利用Python中的内置函数去实现直接排序,需要的朋友可以参考下
    2023-04-04
  • python爬取音频下载的示例代码

    python爬取音频下载的示例代码

    这篇文章主要介绍了python爬取音频下载的示例代码,帮助大家更好的理解和学习python爬虫,感兴趣的朋友可以了解下
    2020-10-10
  • Django request.META.get()获取不到header头的原因分析

    Django request.META.get()获取不到header头的原因分析

    这篇文章主要介绍了Django request.META.get()获取不到header头的原因分析,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2021-04-04
  • Python闭包函数定义与用法分析

    Python闭包函数定义与用法分析

    这篇文章主要介绍了Python闭包函数定义与用法,结合实例形式分析了Python闭包函数的功能、定义、使用方法及相关操作注意事项,需要的朋友可以参考下
    2018-07-07
  • python自动化测试selenium核心技术处理弹框

    python自动化测试selenium核心技术处理弹框

    这篇文章主要为大家介绍了python自动化测试selenium核心技术处理弹框的示例详解,有需要的朋友可以借鉴参考下,希望能够有所帮助
    2021-11-11
  • python中while和for的区别总结

    python中while和for的区别总结

    在本篇内容里小编给大家分享的是关于python中while和for的区别以及相关知识点,需要的朋友们可以学习下。
    2019-06-06
  • Python Excel vlookup函数实现过程解析

    Python Excel vlookup函数实现过程解析

    这篇文章主要介绍了Python Excel vlookup函数实现过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-06-06
  • Scrapy-Redis结合POST请求获取数据的方法示例

    Scrapy-Redis结合POST请求获取数据的方法示例

    这篇文章主要给大家介绍了关于Scrapy-Redis结合POST请求获取数据的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用Scrapy-Redis具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
    2019-05-05

最新评论