pip常见用法汇总

摘要:
Piplist和pipfreeze–都表示所有库,包括Python安装附带的pip和setuptools。

1、pip安装

yum -y install epel-release && yum -y install python-pip

2、pip安装软件

(1)安装单个软件:pip install PackageName

(2)更新单个软件:pip install --upgrade PackageName

(3)卸载单个软件:pip uninstall PackageName

(4)查看已安装的软件:pip list或pip freeze –all或pip freeze(一般使用)

这三个的区别:pip freeze表示是后期安装的库,不包括安装python时自带的pip和setuptools。pip list和pip freeze –all表示所有的库,包括安装python时自带的pip和setuptools。

(5)列出所有过期的库;pip list --outdated

(6)pip批量更新(注意--upgrade后面的空格)

import pip

from subprocess import call

for dist in pip.get_installed_distributions():

    call("pip install –upgrade " + dist.project_name, shell=True)

(7)pip批量安装package

将需要安装的包保存在aa.txt中(pip freeze > aa.txt), cd到aa.txt所在目录,运行:pip install -r aa.txt

(8)pip批量卸载package

将需要卸载的包保存在aa.txt中,cd到aa.txt所在目录,运行:pip uninstall -r aa.txt

 

3、pip参数解释

pip --help

 Usage:  pip <command> [options]

 Commands:

  install             安装包.

  uninstall           卸载包.

  freeze             按着一定格式输出已安装包列表

  list                列出已安装包.

  show              显示包详细信息.

  search             搜索包,类似yum里的search.

  wheel             Build wheels from your requirements.

  help               当前帮助.

General Options:

  -h, --help            显示帮助.

  -v, --verbose          更多的输出,最多可以使用3次

  -V, --version          现实版本信息然后退出.

  -q, --quiet            最少的输出.

  --log-file <path>    覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log

  --log <path>          不覆盖记录verbose输出的日志.

  --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.

  --timeout <sec>         连接超时时间 (默认15秒).

  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.

  --cert <path>            证书.

免责声明:文章转载自《pip常见用法汇总》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇对象拓展水晶报表,不能在IE里预览。下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

【windows】卸载Jupyter book

发现直接pip uninstall jupyter后,还是可以通过jupyter notebook启动jupyter jupyter notebook 彻底卸载jupyter的办法: pip uninstall jupyter -y pip uninstall jupyter_core -y pip uninstall jupyter-client -y...

解决python3 pip安装、更新及yaml安装

问题:python3.6版本使用pip安装第三方库时总是报错 电脑中存在多个python版本写成对应pip版本 解决:pip3 install pyOpenSSL -i http://pypi.douban.com/simple --trusted-host pypi.douban.com  pyOpenSSL:为要安装的包名    源地址:http://...

Gitea安装笔记

什么是gitea Gitea 是一个开源社区驱动的轻量级代码托管解决方案,后端采用 Go 编写,采用 MIT 许可证. 官网:https://gitea.io/zh-cn/ 为什么要用gitea 开源免费 系统要求低,节约资源 gitea的安装(centos 7源码安装) 相关环境安装 yum install -y wget yum install -...

ModuleNotFoundError: No module named 'numpy.testing.nosetester'----import sklearn.datasets.make_moons报错

import sklearn.datasets.make_moons时: 报错: ModuleNotFoundError: No module named 'numpy.testing.nosetester' 原因: numpy、sklearn、scipy、joblib版本不兼容。 解决方法: 将所有的包都更新到最新版本。 【可添加清华源 -ihttps:...

linux下编译GDAL3.x(集成Proj和Geos等)

目录 1、准备工作 2、生成 Makefile 1、报错 "checking for sqlite3_open in -lsqlite3 ... no" 2、 checking for proj_create_from_wkt in -lproj 未通过 3、checking for H5Fopen in -lhdf5... no 4、configu...

Fedora 15 安装与配置一览[转]

Fedora 15 将于2011.5.24日发布,今日离正式版发布还有4天。笨兔兔这里提前给大家支招用好Fedora 15。下面是笨兔兔在安装、配置Fedora 15 过程中的小结,希望给大家配置自己的Fedora 15 带来方便。仅供参考,如有错误,敬请指出。 『一』安装介绍 Fedora 15 Beta 下载地址@http://fedoraprojec...