将python升级到3.7后终端未打开

Sho*_*ikh 13 gnome-terminal python3 18.04

我已将 python 升级到 3.7 版,现在我的终端没有打开。

我关注了这篇文章https://jcutrer.com/linux/upgrade-python37-ubuntu1810

我运行的命令如下,

sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
sudo update-alternatives --config python3
Run Code Online (Sandbox Code Playgroud)

为python3.7输入2

我无法打开终端并运行命令。

我的 ubuntu 版本是 Ubuntu 18.04.2 LTS

小智 24

这样升级到3.7就没用了。您应该编辑gnome-terminal文件:

打开终端并发出以下命令:

cd /usr/bin
sudo nano gnome-terminal
Run Code Online (Sandbox Code Playgroud)

更改#!/usr/bin/python3#!/usr/bin/python3.6

这样您仍然可以使用 3.7 的强大功能并解决终端问题。

  • 这个修复对我来说不适用于 Python 3.10。我不得不使用Python3.8。 (2认同)

Sho*_*ikh 9

我运行了命令

sudo update-alternatives --config python3
Run Code Online (Sandbox Code Playgroud)

进入 1

我拿回了我的终端。

仍然想知道为什么它不能与 python3.7.1 一起使用。

要在终端未打开时访问命令行,请尝试使用以下快捷方式在虚拟终端上运行命令或参考how-to-access-bash-without-a-terminal-emulator

Ctrl+Alt+(F1通过F4至少,也许高达F6)在虚拟控制台上运行终端界面。到达那里后,要返回 GUI,请使用Ctrl+Alt+F7.