1. 程式人生 > >Python-pip

Python-pip

python-pip pip-9.0.1 python2.7

pip 安裝

初始化系統 安裝PIP 問題?

一、更新Python 至2.7以上

yum install wget gcc gcc-c++ -y

wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz

tar -xf Python-2.7.6.tgz

mv Python-2.7.6 /usr/local/python

cd /usr/local/python/

./configure --prefix=/usr/local/python/

make &&make install

ln -s /usr/local/python/bin/python2.7 /usr/bin/python

驗證:python -v


二、安裝 pip

wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9

tar -xf pip-9.0.1.tar.gz

mv pip-9.0.1 /usr/local/pip

python setup.py install

1、提示報錯:?

ImportError: No module named setuptools

則安裝 setuptools


三、setuptools 插件安裝

wget wget http://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz

tar -xf setuptools-2.0.tar.gz

mv setuptools-2.0 /usr/local/pip/setuptools

cd /usr/local/pip/setuptools/

python setup.py install

1、又提示報錯:?

Compression requires the (missing) zlib module

沒有 zlib 模塊;這個可以直接 yum 安裝 (yum 完成之後需要重新編譯python )

yum install zlib zlib-devel -y

2、 python 重新編譯

cd /usr/local/python/

make &&make install

3、安裝 setuptools

cd /usr/local/pip/setuptools

python setup.py install

4、安裝pip

cd /usr/local/pip

python setup.py install


5、創建pip軟鏈接

ln -s /usr/local/python27/bin/pip /usr/bin/pip

至此pip 就安裝好了 ;

6、pip -V 驗證版本;就可以使用python pip 安裝更新文件了

[[email protected] pip]# pip --version

pip 9.0.1 from /usr/local/python/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)


本文出自 “logs” 博客,請務必保留此出處http://51log.blog.51cto.com/6076767/1922918

Python-pip