wu@acer:~$ ls -l /usr/bin/ | grep python -rwxr-xr-x 1 root root 1056 4月 16 2018 dh_python2 lrwxrwxrwx 1 root root 23 11月 12 22:31 pdb2.7 -> ../lib/python2.7/pdb.py lrwxrwxrwx 1 root root 23 10月 22 19:32 pdb3.6 -> ../lib/python3.6/pdb.py lrwxrwxrwx 1 root root 31 10月 25 19:11 py3versions -> ../share/python3/py3versions.py lrwxrwxrwx 1 root root 9 4月 16 2018 python -> python2.7 lrwxrwxrwx 1 root root 9 4月 16 2018 python2 -> python2.7 -rwxr-xr-x 1 root root 3670448 11月 12 22:31 python2.7 lrwxrwxrwx 1 root root 9 10月 25 19:11 python3 -> python3.6 -rwxr-xr-x 2 root root 4522328 10月 22 19:32 python3.6 -rwxr-xr-x 2 root root 4522328 10月 22 19:32 python3.6m lrwxrwxrwx 1 root root 10 10月 25 19:11 python3m -> python3.6m -rwxr-xr-x 1 root root 152 11月 11 2017 python3-pbr lrwxrwxrwx 1 root root 29 4月 16 2018 pyversions -> ../share/python/pyversions.py
能夠看到python -> python2.7
,因此要把它指向下面那個Python3.6python
sudo rm /usr/bin/python sudo ln -s /usr/bin/python3.6 /usr/bin/python
wu@acer:~$ ls -l /usr/bin/ | grep python -rwxr-xr-x 1 root root 1056 4月 16 2018 dh_python2 lrwxrwxrwx 1 root root 23 11月 12 22:31 pdb2.7 -> ../lib/python2.7/pdb.py lrwxrwxrwx 1 root root 23 10月 22 19:32 pdb3.6 -> ../lib/python3.6/pdb.py lrwxrwxrwx 1 root root 31 10月 25 19:11 py3versions -> ../share/python3/py3versions.py lrwxrwxrwx 1 root root 18 2月 23 15:44 python -> /usr/bin/python3.6 lrwxrwxrwx 1 root root 9 4月 16 2018 python2 -> python2.7 -rwxr-xr-x 1 root root 3670448 11月 12 22:31 python2.7 lrwxrwxrwx 1 root root 9 10月 25 19:11 python3 -> python3.6 -rwxr-xr-x 2 root root 4522328 10月 22 19:32 python3.6 -rwxr-xr-x 2 root root 4522328 10月 22 19:32 python3.6m lrwxrwxrwx 1 root root 10 10月 25 19:11 python3m -> python3.6m -rwxr-xr-x 1 root root 152 11月 11 2017 python3-pbr lrwxrwxrwx 1 root root 29 4月 16 2018 pyversions -> ../share/python/pyversions.py
wu@acer:~$ python Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>