[root@tiejiang ~]# yum install gcc gcc-c++ zlib-devel -y
1、下载python3.5软件包
[root@tiejiang src]# wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
[root@tiejiang src]# tar zxvf Python-3.5.0.tgz
[root@tiejiang src]# cd Python-3.5.0
[root@tiejiang Python-3.5.0]# ./configure –prefix=/usr/local/python3.5
[root@tiejiang Python-3.5.0]# make && make install
2、下载并安装setuptools 18.5
[root@tiejiang src]# wget https://bootstrap.pypa.io/ez_setup.py -O – | python
3、备份原有python命令执行文件
[root@tiejiang src]# mv /usr/bin/python /usr/bin/pythonbak
4、创建新python软连接
[root@tiejiang src]# ln -s /usr/local/python3.5/bin/python3.5 /usr/bin/python
5、查看python版本
[root@tiejiang src]# python
Python 3.5.0 (default, Feb 29 2016, 07:06:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>>
6、修改yum配置文件
[root@tiejiang ~]# vim /usr/bin/yum
#!/usr/bin/python
改为
#!/usr/bin/python2.6
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/55443.html