我必须在Windows服务器上运行Python脚本。我怎么知道我用的是哪个版本的Python,这真的很重要吗?

我在考虑升级到最新版本的Python。


当前回答

主要是使用命令:

python -version

Or

python -V

其他回答

Use

python -V

or

python --version

注意:请注意python -V命令中的“V”是大写V。python -V(小“V”)将以verbose模式启动python。

Python 2.5 +:

python --version

Python 2.4 -:

python -c 'import sys; print(sys.version)'

打开一个命令提示窗口(按Windows + R,键入cmd,并按Enter)。

类型python.exe

python -V

http://docs.python.org/using/cmdline.html#generic-options

——version也可以工作(在2.5版本中引入)

对我来说,打开CMD并运行

py

会显示一些东西

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.