转自:pip安装使用详解 – 运维生存时间
http://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..tar.gz
# cd pip-1.5.
# python setup.py install

2. 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

3. pip使用实例

3.1 安装redis

# pip install redis

3.2 卸载redis

# pip uninstall redis
Uninstalling redis:
/usr/lib/python2./site-packages/redis-2.9.-py2..egg-info
.....省略一些内容....
Proceed (y/n)? y
Successfully uninstalled redis

3.3 查看待更新包

pip list --outdate
pygpgme (Current: 0.1 Latest: 0.3)
pycurl (Current: 7.19. Latest: 7.19.3.1)
iniparse (Current: 0.3. Latest: 0.4)

4. 常见错误

4.1 ImportError No module named setuptools
请参考《ImportError No module named setuptools解决

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> 证书.

6、使用yum安装pip

首先安装epel扩展源:

sudo yum -y install epel-release

yum install python-pip

6. 结束

pip安装使用详解【转】的更多相关文章

  1. pip安装使用详解(转)

    pip类似RedHat里面的yum,安装Python包非常方便.本节详细介绍pip的安装.以及使用方法. 1.pip下载安装 1.1 pip下载   1 # wget "https://py ...

  2. pip安装使用详解

    pip类似RedHat里面的yum,安装Python包非常方便.本节详细介绍pip的安装.以及使用方法. 1.pip下载安装 1.1 pip下载   1 # wget "https://py ...

  3. Linux pip安装使用详解

    简介 pip是Python有它自己的包管理工具,与yum和apt-get相似. 安装步骤: 1.下载get-pip.py:https://bootstrap.pypa.io/get-pip.py 2. ...

  4. (转)python中调用R语言通过rpy2 进行交互安装配置详解

    python中调用R语言通过rpy2 进行交互安装配置详解(R_USER.R_HOME配置) 2018年11月08日 10:00:11 luqin_ 阅读数:753   python中调用R语言通过r ...

  5. TortoiseGIT的安装过程详解

    TortoiseGIT简介 TortoiseGIT 是Git版本控制系统的一个免费开源客户端,它是git版本控制的 Windows 扩展.可以使你避免使用枯燥而且不方便的命令行.它完全嵌入 Windo ...

  6. linux PHP 编译安装参数详解

    linux PHP 编译安装参数详解 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc -- ...

  7. Eclipse IDE for C/C++ Developers安装配置详解

    Eclipse IDE for C/C++ Developers安装配置详解(转) 转自:http://hi.baidu.com/ltb6w/item/986532efd712460f570f1ddc ...

  8. loadrunner11.0 安装破解详解使用教程

    loadrunner11.0 安装破解详解使用教程 来源:互联网 作者:佚名 时间:01-21 10:25:34 [大 中 小] 很多朋友下载了loadrunner11但不是很会使用,这里简单介绍下安 ...

  9. Cloudera CDH 、Impala本地通过Parcel安装配置详解及什么是Parcel

    本文引用自:Cloudera CDH .Impala本地通过Parcel安装配置详解及什么是Parcelhttp://www.aboutyun.com/forum.php?mod=viewthread ...

随机推荐

  1. JavaScript常用方法(工具类的封装)

    日期格式化 function formatDateTime(timeStamp) { var date = new Date(); date.setTime(timeStamp); var y = d ...

  2. bzoj5123 [Lydsy12月赛]线段树的匹配

    题意: 线段树是这样一种数据结构:根节点表示区间 [1, n]:对于任意一个表示区间 [l, r] 的节点,若 l < r, 则取 mid = ⌊l+r/2⌋,该节点的左儿子为 [l, mid] ...

  3. selenium学习网址

    1.http://www.testclass.net/selenium_java/#      testclass网址 2.http://www.yiibai.com/selenium/seleniu ...

  4. 【数据库_Mysql】JAVA-数据库Date格式在前台JSP页面的获取

    问题: 数据库保存的为date格式的日期 在前台JSP页面显示的为一串数字1487897     解决办法: 数据库表中字段对应的实体对象属性的get方法上添加一行代码 页面即可正常显示      

  5. C++解析(15):二阶构造模式

    0.目录 1.构造函数与半成品对象 2.二阶构造 3.小结 1.构造函数与半成品对象 关于构造函数: 类的构造函数用于对象的初始化 构造函数与类同名并且没有返回值 构造函数在对象定义时自动被调用 问题 ...

  6. windows下载执行命令大全

      1.bitsadmin命令(只能命令下载到指定路径上,win7以上): bitsadmin /transfer myDownLoadJob /download /priority normal & ...

  7. Communications link failure;;The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure::The ...

  8. SQL Server参数化SQL语句中的like和in查询的语法(C#)

    sql语句进行 like和in 参数化,按照正常的方式是无法实现的 我们一般的思维是: Like参数化查询:string sqlstmt = "select * from users whe ...

  9. bzoj2314: 士兵的放置(树形DP)

    0表示被父亲控制,1表示被儿子控制,2表示被自己控制.f表示最少士兵数,g表示方案数. 转移贼难写,写了好久之后写不下去了,看了一眼题解,学习了...原来还可以这么搞 比如求f[i][1]的时候,要在 ...

  10. 据说要写一个CTSC&APIO的收获

    就不写流水帐了,总的写一下吧.先从最浅显的地方开始——知识.大概被普及了一发带花树,算上自己的考试,还被普及了一发洲阁筛.当然更多的还是对于一些知识的强化,比如:乱搞(这东西真是太重点了啊).DP.数 ...