centos6.5更新python2.7影响pip和easy_install

前端之家收集整理的这篇文章主要介绍了centos6.5更新python2.7影响pip和easy_install前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  • 一般更新python的时候只知道会影响yum,但没注意会影响pip和easy_install,需要卸载安装


  1. 安装依赖环境

    1. yum install zlib-devel zlibopenssl openssl-devel readline-devel(zlib安装setuptools的时候会用到,没有的会报“RuntimeError: Compression requires the (missing) zlib module”;openssl是pip会用到,没有会报ImportError: cannot import name HTTPSHandle,如果不提前安装会来回重新编译安装python,很浪费时间)

  2. 安装python

    1. wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz

    2. tar -xvf Python-2.7.8.tar.xz

    3. cd Python-2.7.8 &&./configure && make && make install

    4. mv /usr/bin/python /usr/bin/python_old

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

  3. 修改yum

    1. vim /usr/bin/yum(把第一行的语言环境改成python_old)

  4. 安装pip

    1. wget https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz#md5=3823d2343d9f3aaab21cf9c917710196

    2. tar xf pip-7.1.2.tar.gz &&cd pip-7.1.2 && python setup.py install

    3. pip install --upgrade pip

    4. pip -V

  5. 安装easy_install

    1. wget https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.tar.gz#md5=52b4e48939ef311d7204f8fe940764f4

    2. tar fxz setuptools-18.2.tar.gz &&cd setuptools-18.2 &&python setup.py install

原文链接:https://www.f2er.com/centos/381054.html

猜你在找的CentOS相关文章