ubuntu:~$ python
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
如果输出了以下内容,说明您安装了 Python2
,您可以尝试输入 python3
启动 Python3
。
ubuntu:~$ python
Python 2.7.17 (default, Feb 27 2021, 15:10:58)
[GCC 7.5.0] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
如果您在输入 python3
后,终端输出了类似如下内容,那么说明您还没有安装 Python3
。
ubuntu:~$ python3
Command ‘python3’ not found, but can be installed with:
sudo apt install python3
您可以使用如下命令安装 python3
:
sudo apt-get install python3