Python专题----A|Python专题----A guid fo python pip
pip类似RedHat里面的yum,安装[Python]包非常方便。本节详细介绍pip的安装、以及使用方法。
1、pip下载安装
1.1 pip下载
# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
1.2 pip安装
# tar -xzvf pip-1.5.4.tar.gz
# cd pip-1.5.4
# python setup.py install
- pip使用详解
2.1 pip安装包
# pip install SomePackage
[...]
Successfully installed SomePackage
2.2 pip查看已安装的包
# pip show --files SomePackage
Name: SomePackage
Version: 1.0
Location: /my/env/lib/pythonx.x/site-packages
Files:
../somepackage/__init__.py
[...]
2.3 pip检查哪些包需要更新
# pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
2.4 pip升级包
# pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
2.5 pip卸载包
$ pip uninstall SomePackage
Uninstalling SomePackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage
- pip使用实例
# pip install redis
3.2 卸载redis
# pip uninstall redis
Uninstalling redis:
/usr/lib/python2.6/site-packages/redis-2.9.1-py2.6.egg-info
.....省略一些内容....
Proceed(y/n)?y
Successfully uninstalled redis
3.3 查看待更新包
pip list--outdate
pygpgme(Current:0.1Latest:0.3)
pycurl(Current:7.19.0Latest:7.19.3.1)
iniparse(Current:0.3.1Latest:0.4)
- 常见错误
请参考《ImportError No module named setuptools解决》
- pip参数解释
# pip --help
Usage:
pip [options]
Commands:
install安装包.
uninstall卸载包.
freeze按着一定格式输出已安装包列表
list列出已安装包.
show显示包详细信息.
search搜索包,类似yum里的search.
wheelBuild 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 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log
--log 不覆盖记录verbose输出的日志.
--proxy 【Python专题----A|Python专题----A guid fo python pip】Specify a proxy in the form [user:passwd@]proxy.server:port.
--timeout连接超时时间 (默认15秒).
--exists-actionDefault action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
--cert 证书.
cover:
http://www.ttlsa.com/python/how-to-install-and-use-pip-ttlsa/
推荐阅读
- python学习之|python学习之 实现QQ自动发送消息
- 逻辑回归的理解与python示例
- python自定义封装带颜色的logging模块
- 【Leetcode/Python】001-Two|【Leetcode/Python】001-Two Sum
- Python基础|Python基础 - 练习1
- Python爬虫|Python爬虫 --- 1.4 正则表达式(re库)
- Python(pathlib模块)
- python青少年编程比赛_第十一届蓝桥杯大赛青少年创意编程组比赛细则
- Python数据分析(一)(Matplotlib使用)
- 为什么文章被4个专题收录了阅读量却是个位数()