1.下载想要的python包,
①地址:http://xiazai.zol.com.cn/detail/33/320958.shtml
②在线下载:wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz
2解压
.bunzip2 Python-3.1.2.tar.bz2(直接解压缩tar -xzvf Python-3.3.0.tgz)
3.进入解压的文件路径
cd Python-3.1.2
4.在编译前先在/cin/local建一个文件夹python3(作为python的安装路径,以免覆盖老的版本)
mkdir /usr/local/python3
5.编译并安装
./configure --prefix=/usr/local/python3
make & make install
6.此时没有覆盖老版本,再将原来/usr/bin/python链接改为别的名字
mv /usr/bin/python /usr/bin/python_old
7.建立新版本python的链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python
8.输入
python
9.显示出python的新版本信息
Python 3.1.2 (r312:79147, Oct 21 2012, 01:03:21))
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
2018-01-04注:如果建立软连并没有进入到想要的python版本,呢么重启下机器
>>>