python2.6升级到2.7

Posted 風£飛

tags:

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

yum install zlib zlib-devel openssl-devel
rpm -aq|grep openssl
wget --no-check-certificate https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar -zxvf Python-2.7.15.tgz
cd Python-2.7.15
./configure --prefix=/usr/local/python2.7 --with-zlib=/usr/include --with-ssl #/usr/local/bin/python2.7默认安装路径
./configure --enable-shared --enable-loadable-sqlite-extensions --with-zlib --with-ssl
make && make install
mv /usr/bin/python /usr/bin/python2
ln -s /usr/bin/python2.7 python #ln -s /usr/local/bin/python2.7 python
vim /usr/bin/yum  #将头部#!/usr/bin/python修改为#!/usr/bin/python2.6
wget https://pypi.python.org/packages/45/29/8814bf414e7cd1031e1a3c8a4169218376e284ea2553cc0822a6ea1c2d78/setuptools-36.6.0.zip#md5=74663b15117d9a2cc5295d76011e6fd1
unzip setuptools-36.6.0.zip
python setup.py install
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
pip install --upgrade pip

python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
1.编辑vi /etc/ld.so.conf 
如果是非root权限帐号登录,使用 sudo vi /etc/ld.so.conf 
添加上python2.7的lib库地址,如我的/usr/local/Python2.7/lib,保存文件
2.执行 /sbin/ldconfig -v命令,如果是非root权限帐号登录,使用 sudo  /sbin/ldconfig -v。这样 ldd 才能找到这个库,执行python2.7就不会报错了

参考链接:
       https://blog.csdn.net/wanyanxgf/article/details/8021641 #解决error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No su
       https://blog.csdn.net/wbj_code_life/article/details/97887891 #环境python3出现pip is configured with locations that require TLS/SSL, however the..不可用的解决方法
       https://blog.csdn.net/qq_40625030/article/details/79908511
       https://www.cnblogs.com/xiaowenshu/p/10239834.html
       https://www.jianshu.com/p/114955beb1e8 #Openssl升级

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

centos python2.6升级到2.7

Python2.6升级到2.7(Centos6)

python2.6升级到2.7

centos6.5升级python2.6到2.7 + 安装pip

Python2.6 升级2.7

linux python2.6升级2.7