centos python2.6 升级到 python2.7

本文详细介绍了如何在基本环境中安装Python 2.7及其依赖库zlib,并配置setuptools和pip等工具,确保Python环境能够正常运行。

基本环境

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. yum只支持2.6所以需要将 /usr/bin/yum 的头部修改成 #!/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.youkuaiyun.com/shaojunbo24/article/details/52300428

http://blog.youkuaiyun.com/ab198604/article/details/8681851

http://blog.youkuaiyun.com/laiahu/article/details/6903100

http://blog.youkuaiyun.com/shanliangliuxing/article/details/18499625

 

转载于:https://www.cnblogs.com/aaron-agu/p/7133754.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值