首页 > 代码库 > centos python2.6 升级到 python2.7

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