如何修复"update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3.8 because



使用Ubuntu 16.04.7时,我试图将python3.8作为我的默认python版本。我遵循了这里给出的说明,但最终标准python版本没有改变。每当我运行时

python -V

输出总是

Python 3.7.9

以下是sudo update-alternatives --config python3:的输出

There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.8   2         auto mode
1            /usr/bin/python3.7   1         manual mode
2            /usr/bin/python3.8   2         manual mode
Press <enter> to keep the current choice[*], or type selection number:

当我选择"0"时,我得到错误:

update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3.8 because link group python3 is broken

谷歌上唯一的热门是另一个没有答案的SO条目!

那么我该如何解决这个问题呢?

此外,这里是ls -l /usr/bin/python*:的输出

lrwxrwxrwx 1 root root      18 Oct 17  2019 /usr/bin/python -> /usr/bin/python2.7
lrwxrwxrwx 1 root root       9 Nov 24  2017 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3488528 Jul 21 19:57 /usr/bin/python2.7
lrwxrwxrwx 1 root root      33 Jul 21 19:57 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root      16 Nov 24  2017 /usr/bin/python2-config -> python2.7-config
-rwxr-xr-x 1 root root     306 Oct 24  2015 /usr/bin/python2-futurize
-rwxr-xr-x 1 root root     310 Oct 24  2015 /usr/bin/python2-pasteurize
lrwxrwxrwx 1 root root      25 Oct  5 08:59 /usr/bin/python3 -> /etc/alternatives/python3
-rwxr-xr-x 2 root root 4456208 Jul 19 22:14 /usr/bin/python3.5
lrwxrwxrwx 1 root root      33 Jul 19 22:14 /usr/bin/python3.5-config -> x86_64-linux-gnu-python3.5-config
-rwxr-xr-x 2 root root 4456208 Jul 19 22:14 /usr/bin/python3.5m
lrwxrwxrwx 1 root root      34 Jul 19 22:14 /usr/bin/python3.5m-config -> x86_64-linux-gnu-python3.5m-config
-rwxr-xr-x 2 root root 5074632 Aug 18 09:35 /usr/bin/python3.7
-rwxr-xr-x 2 root root 5074632 Aug 18 09:35 /usr/bin/python3.7m
-rwxr-xr-x 1 root root 5391992 Sep 26 00:51 /usr/bin/python3.8
lrwxrwxrwx 1 root root      16 Mar 23  2016 /usr/bin/python3-config -> python3.5-config
lrwxrwxrwx 1 root root      10 Mar 23  2016 /usr/bin/python3m -> python3.5m
lrwxrwxrwx 1 root root      17 Mar 23  2016 /usr/bin/python3m-config -> python3.5m-config
lrwxrwxrwx 1 root root      16 Nov 24  2017 /usr/bin/python-config -> python2.7-config
lrwxrwxrwx 1 root root      58 Mar 25  2016 /usr/bin/pythontex -> ../share/texlive/texmf-dist/scripts/pythontex/pythontex.py
-rwxr-xr-x 1 root root     306 Mar 25  2016 /usr/bin/pythontex3

我为python定义了一个别名!这就是为什么传统逻辑在这里不适用!

我通过这种方式将py3.8设置为默认值

export py=`which python`
sudo rm $py
export py38=`which python3.8`
sudo ln -s $py38 $py

相关内容

  • 没有找到相关文章

最新更新