温馨提示×

debian怎么查python版

小樊
44
2026-09-29 07:00:30
栏目: 编程语言

在 Debian 系统里,查看 Python 版本有几种常用方法:

1. 查看默认 python 命令版本

python --version

或

python -V

注意:在较新的 Debian(如 Debian 11+)中,默认可能没有 python 命令,只有 python3。

2. 查看 python3 版本

python3 --version

3. 查看所有已安装的 Python 版本

ls /usr/bin/python*

或

dpkg -l | grep python

4. 进入 Python 交互模式查看

python3

进入后会出现类似:

Python 3.11.2 (main, ...)

输入 exit() 退出。

5. 查看详细版本信息

python3 -c "import sys; print(sys.version)"

如果你是想确认系统用的是哪个 Python 做默认解释器,也可以看:

which python3

需要我帮你查 Debian 某个版本(比如 Debian 12)默认带哪个 Python 吗?

0 踩