前言:
当前咱们对“centos6升级python”大致比较着重,各位老铁们都需要学习一些“centos6升级python”的相关内容。那么小编在网上搜集了一些关于“centos6升级python””的相关文章,希望同学们能喜欢,你们一起来学习一下吧!下载Python源码包:
[root@localhost ~]# wget
解压、编译、安装:
[root@localhost ~]# tar -xzvf ./Python-3.6.5.tgz -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/Python-3.6.5/
[root@localhost Python-3.6.5]# ./configure –prefix=/usr/local/python
[root@localhost Python-3.6.5]# make [root@localhost Python-3.6.5]# make install
修改环境变量:
[root@localhost Python-3.6.5]#sudo vim /etc/profile
[root@localhost Python-3.6.5]#source /etc/profile
[root@localhost Python-3.6.5]#python -V [root@localhost Python-3.6.5]#pip3 -V
设置默认python版本 :
[root@localhost Python-3.6.5]#mv /usr/bin/python /usr/bin/python2.6
[root@localhost ~]# ln -s /usr/local/python/bin/python3.6 /usr/bin/python
解决Python升级后,yum不能正常工作的问题:
[root@localhost ~]#vi /usr/bin/yum
将 #!/usr/bin/python 改成 #!/usr/bin/python2.6
标签: #centos6升级python