转载:
Linux安装python 2.7.9

Linux安装python 2.7.9
1、下载python

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

2、解压、编译安装
make install 需要root权限。

tar -zxvf Python-2.7.9.tgz
cd Python-2.7.9
./configure --prefix=/usr/local/python-2.7.9
make
make install

3、系统自带了python版本,我们需要为新安装的版本添加一个软链

rm /usr/bin/python
ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python

通过命令python2.7.9查看版本:

>python 
Python 2.7.9 (default, Dec 14 2017, 23:13:13) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Logo

更多推荐