Skip to content

Instantly share code, notes, and snippets.

@yiquncode
Last active October 7, 2015 03:28
Show Gist options
  • Save yiquncode/3098226 to your computer and use it in GitHub Desktop.
Save yiquncode/3098226 to your computer and use it in GitHub Desktop.
install python26 in centos and replace the old version(2.4)
#python26#
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
sudo rpm -ivh epel-release-5-4.noarch.rpm
yum -y install python26
ln -f /usr/bin/python2.6 /usr/bin/python
python -V
#EOF python26
#For python2.7#
yum install -y bzip2*
cd /root/src
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar zvxf Python-2.7.3.tgz
cd Python-2.7.3
./configure
make && make install
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python2.7 /usr/bin/python
python -V #check soft link
#python3
wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
tar zxvf Python-3.4.2.tgz
cd Python-3.4.2
./configure --prefix=/usr/local/python342
make
make install
#ISSUE
#解决系统python软链接指向python2.7版本后,yum不能正常工作
$vi /usr/bin/yum
#将文本编辑显示的#/usr/bin/python修改为#/usr/bin/python2.4,保存修改即可。
@yiquncode
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment