1.使用Ubuntu 系统查看python 版本是2.x 想升级成3.x
系统里我的是2.x:
mnt/hgfs/SHARE/Project/myPython$ python
Python 2.7.12 (default, Jul 21 2020, 15:19:50)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
可以先看看 /usr/bin/ 目录下有的python ,例如我的目录下:
ls /usr/bin/ |grep python
mnt/hgfs/SHARE/Project/webbench-1.5$ ls /usr/bin/ |grep python
dh_python2
dh_python3
python
python2
python2.7
python3
python3.5
python3.5m
python3m
我的系统有2.7 版本和3.5版本,只需改变下python 链接到3.5即可,(如果没有3.x 的版本可先在线安装:sudo apt-get install python3)
系统有3.x版本后,先删除久链接文件:
sudo rm /usr/bin/python
再重新将python 链接到3.x 版本:
sudo ln -s /usr/bin/python3.5 /usr/bin/python
最后输入python 命令查看python版本已经变成3.x 的版本:
dg@ubuntu:/mnt/hgfs/SHARE/Project/myPython$ python
Python 3.5.2 (default, Jul 17 2020, 14:04:10)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>