python - 如何修复 "update-alternatives: warning: forcing reinstallation of alternative/usr/bin/python3.8 because link group python3 is broken"?

标签 python python-3.x ubuntu

使用 Ubuntu 16.04.7 我试图将 python3.8 设置为我的默认 python 版本。我按照 here 给出的说明进行操作,但最终标准 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

Google 上唯一的接近命中是另一个没有答案的 SO entry!

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

此外,这是 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定义了一个别名!这就是为什么传统逻辑在这里不适用!

关于python - 如何修复 "update-alternatives: warning: forcing reinstallation of alternative/usr/bin/python3.8 because link group python3 is broken"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64203820/

相关文章:

python - 在 Pycharm 中到处搜索评论

python-3.x - 谷歌应用引擎 - 应用因长期部署而变得不健康

python - 如何将 PIL 图像转换为字符串,然后将其转换回 PIL 图像?转换将在不保存到新文件的情况下完成

docker - 在前台运行 Goofys 是防止传输端点断开连接的唯一方法

apache - 基于目录的多个文档根?

Python 获取矩阵中具有 na 值的邻居的平均值

python - Windows WSL 的 Poetry 安装不起作用,忽略 $HOME

python - 在 Python 中调用具有混合数据类型参数的子进程

python - 尝试使用 nohup 启动 Python 脚本时出现语法错误

python-3.x - 无法通过 boto3 查询 DynamoDB 中的分区键