24123r2 发表于 2016-12-30 10:08:31

python2.6.6升级python3.5.2

以centos为例
默认python版本为:
python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


升级py 我们这边用的是较新的版本3.5
一、下载及安装

wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar -zxvf Python-3.5.2.tgz
cd Python-3.5.2
mkdir /usr/local/python3
./configure --prefix=/usr/local/python3
make && make install
二、重命名老python版本,把新版本软连接到系统环境中

mv /usr/bin/python /usr/bin/python_26
ln -s /usr/local/python3/bin/python3 /usr/bin/python

三、验证
python
Python 3.5.2 (default, Dec 29 2016, 16:34:53)
on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>


# cat test.py
import os
print ('hello world')
# python test.py
hello world
#


1301664724 发表于 2017-1-3 16:32:30

学习了,谢谢分享!!!
页: [1]
查看完整版本: python2.6.6升级python3.5.2