简体   繁体   中英

Python 2.7.9 on Centos 6.7?

I need to upgrade Python on my centos 6.7 machine to 2.7.9, but everything I've been reading has said that will break "yum" on my system. Does this issue still exist? I'm only finding much older posts confirming, and I don't really know what I'm doing so I don't want to break anything.

You can install additional version of Python:

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
tar xf Python-2.7.9.tar.xz
cd Python-2.7.9
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make
make altinstall

Finally check the Python version:

python2.7 -V

should return

Python 2.7.9

The old version of Python should be available as python2:

python2 -V

(Python 2.7.5 in my case)

Important: You may need to install the prerequisites before compiling Python:

yum groupinstall "Development tools"
yum install sqlite-devel

I hope that this will solve your problem!

I have had some trouble using Python on CentOS due to yum requring Python2.6. But you should be able to upgrade and run yum. yum is python script and if it doesn't work maybe you can run it with the right Python version. For example

python2.7 /usr/bin/yum .....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM