You need to simply type the following commands to find out python version (open the terminal application or shell prompt):
## type at your shell ## python -V
OR
## type at your shell ## python --version
Sample outputs:
Python 2.7.14
So I am using Python version 2.17.14. The -V or –version option shows the Python version number of the executable and exit. For Python 3, try the follwoing command:
$ python3 -V
## or ##
$ python3 --version
Sample outputs:
Python 3.6.3
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 5 comments so far... add one ↓
🐧 5 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I’d like to know what version of Python a module is made for before I download it – 2.7 or 3.3. Often it’s not stated or I can’t figure how to find it. I’m not sure why they don’t make that clear or maybe I’m missing something because I’m new at it. I searched google for that idea but all it does is tells me how to find the Module version. I don’t want that. I want to know what version of python a module is for. It doesn’t seem to be clearly stated on download sites or even in the module or documentation.
I am getting ‘python’ is not defined
Don’t type “python -V” at the python command prompt (interpreter) but at the command prompt of the shell you are using … here’s an example on Windows :
C:\Python33>python -V
Python 3.3.2
If you want to know from within python command prompt you will have to type …
C:\Python33>python
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import sys
>>> sys.version
‘3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)]’
Hope this helps.
How may one change the version of Python which they have installed?
Thanks. Was very helpful