centos python2.6 升级到 python2.7

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos python2.6 升级到 python2.7相关的知识,希望对你有一定的参考价值。

基本环境

yum -y install wget gcc xz tar

安装 zlib (如果不装zlib setuptools可能报错 "Compression requires the (missing) zlib module")

    1. wget http://prdownloads.sourceforge.net/libpng/zlib-1.2.11.tar.gz?download

 2. tar -xvf zlib-1.2.11.tar.gz 

 3. cd zlib-1.2.11  &&  ./configure && make && make install

 

安装 python

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

2. xz -d Python-2.7.12.tar.xz && tar -xvf Python-2.7.12.tar 

3. cd Python-2.7.12 && ./configure && make && makeinstall

4. mv /usr/bin/python /usr/bin/python2.6.6

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

6. vim /usr/bin/yum

7. 修改头部 #!/usr/bin/python2.6.6

如果python 报错”error while loading sharedlibraries: libpython2.7.so.1.0: cannot open shared object file: No such file ordirectory”

vim /etc/ld.so.conf 下一行加 /usr/local/lib  然后执行  /sbin/ldconfig -v

 

安装 setuptools

1. wget https://pypi.python.org/packages/a9/23/720c7558ba6ad3e0f5ad01e0d6ea2288b486da32f053c73e259f7c392042/setuptools-36.0.1.zip#md5=430eb106788183eefe9f444a300007f0

2. unzip setuptools-36.0.1.zip && cd setuptools-36.0.1

3. python setup.py install

4. easy_install pip

 

 

http://blog.csdn.net/shaojunbo24/article/details/52300428

http://blog.csdn.net/ab198604/article/details/8681851

http://blog.csdn.net/laiahu/article/details/6903100

http://blog.csdn.net/shanliangliuxing/article/details/18499625

 

以上是关于centos python2.6 升级到 python2.7的主要内容,如果未能解决你的问题,请参考以下文章

centos6 升级python2.6 到 python2.7

centos python2.6 升级到 python2.7

centos python2.6升级到2.7

技巧方法 - CentOS6将Python2.6.6升级到Python2.7.6

centos python2.6 升级到python2.7

Python2.6升级到2.7(Centos6)