跳到导航 跳到搜索


wget https://bootstrap.pypa.io/get-pip.py
 python3 get-pip.py 

#debian 还可以这样 
apt-get install python3-pip

apt install python-pip

python3 自带了pip3

Centos7 python3 and pip3


升级 pip

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y python-pip



How to install python2.7 on centos6.x

#第一种 官方推荐办法 
#on rhel 7  或者 centos6 有python2.7 
wget https://bootstrap.pypa.io/get-pip.py
python  get-pip.py

#第二种 源码 
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
tar xvf pip-9.0.1.tar.gz && cd pip-9.0.1/
sudo python setup.py install

#第三种  easy_install


[[email protected] home] wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
[[email protected] home] python ez_setup.py
#如果提示 IOError: [Errno url error] unknown url type: 'https'  错误就是没有安装openssl-devel 导致,yum安装openssl-devel 然后再重新编译安装Python2.7
#安装完成后可以看到/usr/local/bin/ 有两个文件
[[email protected] bin]#  ll easy_install*
-rwxr-xr-x. 1 root root 409 12月  5 18:56 easy_install
-rwxr-xr-x. 1 root root 417 12月  5 18:56 easy_install-2.7

[[email protected] home] easy_install pip
[[email protected] home] pip -V
pip 9.0.1 from /usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)


2. pip使用详解

2.1 pip安装包
pip install SomePackage
2.2 pip查看已安装的包
pip show –files SomePackage
2.3 pip检查哪些包需要更新
pip list –outdated
SomePackage (Current: 1.0 Latest: 2.0)
2.4 pip升级包
pip install –upgrade SomePackage

2.5 pip卸载包

$ pip uninstall SomePackage

3. pip使用实例
3.1 安装Django

pip install Django

3.2 卸载Django

pip uninstall Django

3.3 查看待更新包
pip list –outdate

4. pip参数解释

pip –help

pip [options]

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 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log
–log 不覆盖记录verbose输出的日志.
–proxy Specify a proxy in the form [user:[email protected]]proxy.server:port.
–timeout 连接超时时间 (默认15秒).
–exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
–cert 证书. 


install pip https://pip.pypa.io/en/stable/installing/

pip 安装和使用 http://blog.linuxchina.net/?p=2793

How to install python2.7 on centos6.x