由于某种原因,我在 Ubuntu 19.04 上安装了 python3.5.2,现在我想将 python3.7 设为python3
终端上的默认命令,甚至从系统中删除 3.5.2 版本。3.5.2 的安装过程如下手动的python3.5.2
,并且目录中没有/usr/bin
:
$ ls /usr/bin/python*
lrwxrwxrwx 1 root root 7 Mar 4 19:18 /usr/bin/python -> python2
lrwxrwxrwx 1 root root 9 Mar 4 19:18 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3691008 Apr 6 06:12 /usr/bin/python2.7
lrwxrwxrwx 1 root root 33 Apr 6 06:12 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root 16 Mar 4 19:18 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 25 Jun 11 10:25 /usr/bin/python3 -> /etc/alternatives/python3
-rwxr-xr-x 2 root root 4877888 Apr 3 10:09 /usr/bin/python3.7
lrwxrwxrwx 1 root root 33 Apr 3 10:09 /usr/bin/python3.7-config -> x86_64-linux-gnu-python3.7-config
-rwxr-xr-x 2 root root 4877888 Apr 3 10:09 /usr/bin/python3.7m
lrwxrwxrwx 1 root root 34 Apr 3 10:09 /usr/bin/python3.7m-config -> x86_64-linux-gnu-python3.7m-config
lrwxrwxrwx 1 root root 16 Mar 26 14:55 /usr/bin/python3-config -> python3.7-config
lrwxrwxrwx 1 root root 10 Mar 26 14:55 /usr/bin/python3m -> python3.7m
lrwxrwxrwx 1 root root 17 Mar 26 14:55 /usr/bin/python3m-config -> python3.7m-config
lrwxrwxrwx 1 root root 14 Mar 4 19:18 /usr/bin/python-config -> python2-config
$ python3.7 -V
Python 3.7.3
$ python3.5 -V
Python 3.5.2
$ python3 -V
Python 3.5.2
系统中的其他一些功能也出现问题。例如,当我使用jupyter notebook
它时,它使用 python3.5.2 作为内核,并且它无法识别我为 3.7 版本安装的库。那么我该如何将 python 版本恢复为 Ubuntu 19.04 默认版本?