简体   繁体   English

Centos 6.7上的Python 2.7.9?

[英]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. 我需要将我的centos 6.7机器上的Python升级到2.7.9,但是我一直在阅读的内容都说这会破坏系统上的“ yum”。 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: 您可以安装其他版本的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: 最后检查Python版本:

python2.7 -V

should return 应该回来

Python 2.7.9

The old version of Python should be available as python2: Python的旧版本应以python2的形式提供:

python2 -V

(Python 2.7.5 in my case) (在我的情况下是Python 2.7.5)

Important: You may need to install the prerequisites before compiling Python: 重要提示:在编译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. 由于百胜要求Python2.6,我在CentOS上使用Python遇到了一些麻烦。 But you should be able to upgrade and run yum. 但是您应该能够升级并运行yum。 yum is python script and if it doesn't work maybe you can run it with the right Python version. yum是python脚本,如果它不起作用,则可以使用正确的Python版本运行它。 For example 例如

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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