Centos6.10 安装Python 2.7.16

部署一个程序,

系统环境:CentOS 6.10 64位

Python版本:2.7

1.升级下系统

yum install eple-release -y

yum update -y

2.下载python 2.7,编译安装

wget https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz
tar xvf Python-2.7.16.tar.xz
cd Python-2.7.16
./configure
make && make install

3.修改默认python

mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python /usr/bin/python
ln -s /usr/local/bin/python2.7 /usr/bin/python2.7
ln -s /usr/local/bin/python-config /usr/bin/python-config

到这一步已经基本安装完毕,但还存在一些小问题需要调整

4.默认的yum 是python2.6,需要修改下,不然没办法使用。

vim /usr/bin/yum
将 #!/usr/bin/python 修改为 #!/usr/bin/python2.6

5.将Python2.6 的module文件拷贝到Python2.7中(不然在安装一些程序时,会提示一些module缺失,还是要拷贝)

cp -r /usr/lib/python2.6/site-packages/yum /usr/local/lib/python2.7/site-packages/
cp -r /usr/lib/python2.6/site-packages/rpmUtils /usr/local/lib/python2.7/site-packages/
cp -r /usr/lib/python2.6/site-packages/iniparse /usr/local/lib/python2.7/site-packages/
cp -r /usr/lib/python2.6/site-packages/urlgrabber /usr/local/lib/python2.7/site-packages/
cp -r /usr/lib64/python2.6/site-packages/rpm /usr/local/lib/python2.7/site-packages/
cp -r /usr/lib64/python2.6/site-packages/curl /usr/local/lib/python2.7/site-packages/
cp -p /usr/lib64/python2.6/site-packages/pycurl.so /usr/local/lib/python2.7/site-packages/
cp -p /usr/lib64/python2.6/site-packages/_sqlitecache.so /usr/local/lib/python2.7/site-packages/
cp -p /usr/lib64/python2.6/site-packages/sqlitecachec.py /usr/local/lib/python2.7/site-packages/
cp -p /usr/lib64/python2.6/site-packages/sqlitecachec.pyc /usr/local/lib/python2.7/site-packages/
cp -p /usr/lib64/python2.6/site-packages/sqlitecachec.pyo /usr/local/lib/python2.7/site-packages/


 



 

转载于:https://www.cnblogs.com/luckyleaf/p/10666734.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值