Which version of Python do I have installed?

2019-01-20 21:39发布

I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to latest version of Python.

18条回答
来,给爷笑一个
2楼-- · 2019-01-20 22:27

Open a command prompt window (press Windows+R, type in cmd, and hit enter). Type python.exe

查看更多
乱世女痞
3楼-- · 2019-01-20 22:32

in a Python IDE just copy and paste in the following code and run it (the version will come up in the output area)

import sys
print(sys.version)
查看更多
霸刀☆藐视天下
4楼-- · 2019-01-20 22:32

you can get version of python by using following command

python --version

You can even get version of any package installed in venv using pip freeze as

pip freeze | grep "package name"

or using python interpreter as

In [1]: import django
In [2]: django.VERSION
Out[2]: (1, 6, 1, 'final', 0)
查看更多
霸刀☆藐视天下
5楼-- · 2019-01-20 22:32

just start it at terminal

python
sergio@tarro:
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
查看更多
放荡不羁爱自由
6楼-- · 2019-01-20 22:34

At a command prompt type:

python -V
查看更多
兄弟一词,经得起流年.
7楼-- · 2019-01-20 22:35
python -V

or

python --version

NOTE :- Please note that the "V" in python-V command is capital V. python -v (small "v") will launch Python in verbose mode.

查看更多
登录 后发表回答