Python包管理工具Pip
pip 是一个Python包管理工具,主要是用于安装 PyPI 上的软件包,可以替代 easy_install 工具。
GitHub: https://github.com/pypa/pip
Doc: https://pip.pypa.io/en/latest/
安装pip
1.脚本安装curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
2.使用包管理软件安装yum install python-pip
3.更新pippip install -U pip
pip基本使用
安装PyPI软件pip install SomePackage
pip install 'SomePackage>=1.0.4'
查看具体安装文件pip show --files SomePackage
查看哪些软件需要更新pip list --outdated
升级软件包pip install --upgrade SomePackage
卸载软件包pip uninstall SomePackage
Requirements文件安装依赖软件pip freeze > requirements.txt
pip install -r requirements.txt
列出软件包清单pip list
查看软件包信息pip show pip
搜寻pip search pycuda
配置文件$HOME/.pip/pip.conf
命令行自动补全(加载此配置文件后,则pip命令支持自动补全功能)
对于bash:pip completion --bash >> ~/.profile
对于zsh:pip completion --zsh >> ~/.zprofile
pip参数解释
# pip --help
Usage:
pip <command> [options]
Commands:
install 安装包.
uninstall 卸载包.
freeze 按着一定格式输出已安装包列表
list 列出已安装包.
show 显示包详细信息.
search 搜索包,类似yum里的search.
wheel Build wheels from your requirements.
zip 不推荐. Zip individual packages.
unzip 不推荐. Unzip individual packages.
bundle 不推荐. Create pybundles.
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> 证书.