温馨提示×

如何查debian python版

小樊
34
2026-09-17 07:49:38
栏目: 编程语言

在 Debian 系统中,可以通过以下几种方式查看已安装的 Python 版本:

方法一:使用命令行直接查看

打开终端,输入以下命令:

python --version

或者

python -V

注意:在较新的 Debian 版本(如 Debian 11/12)中,默认可能只安装了 python3,而没有 python 命令。如果提示 command not found,请使用下面的命令。

python3 --version

方法二:查看所有已安装的 Python 版本

如果你想看系统里装了哪些 Python(包括 python2 和 python3),可以用:

ls /usr/bin/python*

或者使用 dpkg 查看通过 apt 安装的 Python 包:

dpkg -l | grep python

方法三:进入 Python 交互模式查看

python3

进入后,第一行就会显示版本信息,例如:

Python 3.11.2 (main, Mar 13 2023, 12:21:11) [GCC 12.2.0] on linux

输入 exit() 或按 Ctrl+D 退出。


方法四:查看 Python 具体路径和版本

which python3
python3 -V

补充说明(Debian 版本对应关系参考)

  • Debian 10 (Buster):Python 3.7
  • Debian 11 (Bullseye):Python 3.9
  • Debian 12 (Bookworm):Python 3.11

如果你是写脚本或做环境管理(如 virtualenv / conda),建议明确使用 python3 命令,避免和系统中的 python2 混淆。

需要我帮你查某个具体 Debian 版本对应的 Python 版本吗?

0