在 Ubuntu 上检查 Python 是否安装成功,可以通过以下步骤进行:
打开终端(快捷键 Ctrl + Alt + T)。
输入以下命令来检查 Python 的版本:
python --version
或者,如果你想检查 Python 3 的版本,可以使用:
python3 --version
按下回车键后,如果 Python 已经安装,你将看到类似如下的输出:
Python 3.8.10
这表示 Python 3.8.10 已经安装在你的系统上。如果显示的是其他版本号,说明你安装的 Python 版本可能不同。
如果你没有安装 Python,或者想要安装特定版本的 Python,你可以使用 Ubuntu 的包管理器 apt 来安装。例如,要安装 Python 3,可以使用以下命令:
sudo apt update
sudo apt install python3
安装完成后,再次运行 python3 --version 命令来确认 Python 3 是否已经成功安装。
请注意,Ubuntu 系统通常默认安装 Python 2 和 Python 3。Python 2 已经在 2020 年 1 月 1 日停止支持,因此建议使用 Python 3。