在 CentOS 系统中,可以通过以下步骤来检查 Python 是否安装成功:
打开终端(Terminal)。
输入以下命令来查看 Python 的版本信息:
python --version
或者
python3 --version
如果 Python 已经安装成功,你将看到类似如下的输出:
Python 2.7.5
或者
Python 3.6.8
这表示你的系统上已经安装了相应版本的 Python。
如果你想检查 Python 的安装路径,可以使用以下命令:
which python
或者
which python3
这将显示 Python 可执行文件的路径,例如:
/usr/bin/python
或者
/usr/bin/python3
你还可以尝试运行 Python 交互式解释器,只需输入 python
或 python3
,然后按回车键。如果看到 Python 提示符(通常以 >>>
开头),则表示 Python 已成功安装并且可以正常工作。
请注意,CentOS 7 默认安装的是 Python 2.x 版本,而 Python 3.x 需要手动安装。如果你需要使用 Python 3.x,请确保已经正确安装了该版本。