Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which version of Python do I have installed?

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 the latest version of Python.

like image 696
Ali_IT Avatar asked Jan 18 '12 21:01

Ali_IT


People also ask

How do I know if I have Python 2 or 3?

Check Python Version: Script This is especially useful when you have multiple Python versions installed on your computer. To check which Python version is running, you can use either the sys or the platform module. The script will be the same for Windows, macOS, and Linux.


2 Answers

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) 
like image 35
pzp Avatar answered Oct 12 '22 16:10

pzp


python -V 

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

--version may also work (introduced in version 2.5)

like image 178
theglauber Avatar answered Oct 12 '22 17:10

theglauber