1、安装setup-tools
下载地址:https://pypi.python.org/pypi/setuptools
下载安装包,可以使用wget命令下载。下载及安装命令如下,
wget https://pypi.python.org/packages/45/29/8814bf414e7cd1031e1a3c8a4169218376e284ea2553cc0822a6ea1c2d78/setuptools-36.6.0.zip#md5=74663b15117d9a2cc5295d76011e6fd1 unzip setuptools-36.6.0.zip cd setuptools-36.6.0 python setup.py install
2、Python2安装pip
下载地址:https://pypi.python.org/pypi/pip
可以使用wget
命令下载。下载及安装命令如下,
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9 tar -zxvf pip-9.0.1.tar.gz cd pip-9.0.1 python setup.py install
3、创建pip软链接
如果上面执行完成,可以正常使用pip
命令,也可以不执行下面命令创建软链接。
进入到/usr/local/python27/bin
目录,如果上面安装没报错的话,就可以看到easy_install
和pip
命令,创建命令如下,
rm -rf /usr/bin/easy_install* /usr/bin/pip ln -s /usr/local/python27/bin/pip2.7 /usr/bin/pip ln -s /usr/local/python27/bin/pip2.7 /usr/bin/pip27 ln -s /usr/local/python27/bin/pip2.7 /usr/bin/pip2.7 ln -s /usr/local/python27/bin/easy_install /usr/bin/easy_install ln -s /usr/local/python27/bin/easy_install /usr/bin/easy_install27 ln -s /usr/local/python27/bin/easy_install /usr/bin/easy_install2.7 # 验证操作是否成功 pip --version pip 9.0.1 from /usr/local/python27/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7) easy_install --version setuptools 36.5.0 from /usr/local/python27/lib/python2.7/site-packages/setuptools-36.5.0-py2.7.egg (Python 2.7)