ubuntu 的 python从2.* 升级到3.*

1、在ubuntu 的终端中用代码下载最新的Python
sudo apt-get install python3

2、用命令删除usr/bin/目录下的默认python link文件
root@salt-master:/usr/bin# ll python*
lrwxrwxrwx 1 root root 9 Dec 10 2015 python -> python2.7*
lrwxrwxrwx 1 root root 9 Dec 10 2015 python2 -> python2.7*
-rwxr-xr-x 1 root root 3546104 Nov 19 2016 python2.7*
lrwxrwxrwx 1 root root 33 Nov 19 2016 python2.7-config -> x86_64-linux-gnu-python2.7-config*
lrwxrwxrwx 1 root root 16 Dec 10 2015 python2-config -> python2.7-config*
lrwxrwxrwx 1 root root 9 Apr 24 17:43 python3 -> python3.5*
-rwxr-xr-x 2 root root 4460336 Nov 18 2016 python3.5*
-rwxr-xr-x 2 root root 4460336 Nov 18 2016 python3.5m*
lrwxrwxrwx 1 root root 10 Apr 24 17:43 python3m -> python3.5m*
lrwxrwxrwx 1 root root 16 Dec 10 2015 python-config -> python2.7-config*

删除链接
lrwxrwxrwx 1 root root 9 Dec 10 2015 python -> python2.7*

创建链接
root@salt-master:/usr/bin# ln -s python3.5 python
查看
root@salt-master:/usr/bin# ll python*
lrwxrwxrwx 1 root root 9 Oct 16 09:28 python -> python3.5*
lrwxrwxrwx 1 root root 9 Dec 10 2015 python2 -> python2.7*
-rwxr-xr-x 1 root root 3546104 Nov 19 2016 python2.7*
lrwxrwxrwx 1 root root 33 Nov 19 2016 python2.7-config -> x86_64-linux-gnu-python2.7-config*
lrwxrwxrwx 1 root root 16 Dec 10 2015 python2-config -> python2.7-config*
lrwxrwxrwx 1 root root 9 Apr 24 17:43 python3 -> python3.5*
-rwxr-xr-x 2 root root 4460336 Nov 18 2016 python3.5*
-rwxr-xr-x 2 root root 4460336 Nov 18 2016 python3.5m*
lrwxrwxrwx 1 root root 10 Apr 24 17:43 python3m -> python3.5m*
lrwxrwxrwx 1 root root 16 Dec 10 2015 python-config -> python2.7-config*

3、执行python -V 会显示版本为3.5.2

升级成功

其他:
pyCharm最新2017激活
server选项里边输入 http://idea.imsxm.com/

原文地址:https://www.cnblogs.com/wclwcw/p/7727164.html