pip安装使用详解
来源:互联网 发布:fstab自动挂载yum 编辑:程序博客网 时间:2024/05/09 10:03
转自https://www.ttlsa.com/python/how-to-install-and-use-pip-ttlsa/
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 SomePackageName: SomePackageVersion: 1.0Location: /my/env/lib/pythonx.x/site-packagesFiles: ../somepackage/__init__.py [...]
2.3 pip检查哪些包需要更新
$pip list --outdatedSomePackage (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使用实例
3.1 安装redis
$pip install redis
3.2 卸载redis
$pip uninstall redisUninstalling 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 --outdatepygpgme (Current: 0.1 Latest: 0.3)pycurl (Current: 7.19.0 Latest: 7.19.3.1)iniparse (Current: 0.3.1 Latest: 0.4)
4.常见错误
4.1 ImportError No module named setuptools
安装ngxtop的过程,执行python setup.py install,报错:“ImportError No module named setuptools”,大概意思是说缺少setuptools这个模块。
安装setuptools:
$wget "https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev" --no-check-certificate$tar -xzvf default.tar.gz$cd pypa-setuptools-eb92fc5071bf //依据你的解压目录名而定$python setup.py install
安装完成之后,在执行你的安装程序命令(python setup.py install)即可。
5.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> 证书.
0 0
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip 安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- pip安装使用详解
- python pip安装使用详解
- Centos下python pip安装使用详解
- sftp通过秘钥上传,修改文件
- iOS进阶面试题一
- 利用runtime添加属性
- 详解Android开发中Activity的四种launchMode
- 【LeetCode】153. Find Minimum in Rotated Sorted Array
- pip安装使用详解
- Lab根据内容动态获取宽、高
- 算法系列2、分治算法
- OC编码规范
- Mac端通过Hexo搭建独立博客
- Python 图片下载PictureSpider
- Java并发编程:阻塞队列
- 2016猴年首一发,台州双线高防机房,速度快
- 关于FPGA中Speed Grade的说明