You can use python -V (et al.) to show you the version of Python that the python command resolves to. If that's all you need, you're done. But to see every version of python in your system takes a bit more.

In Ubuntu we can check the resolution with readlink -f $(which python). In default cases in 14.04 this will simply point to /usr/bin/python2.7.

We can chain this in to show the version of that version of Python:

$ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: "; % -V'
/usr/bin/python2.7: Python 2.7.6

But this is still only telling us what our current python resolution is. If we were in a Virtualenv (a common Python stack management system) python might resolve to a different version:

$ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: "; % -V'
/home/oli/venv/bin/python: Python 2.7.4

This is real output.

The fact is there could be hundreds of different versions of Python secreted around your system, either on paths that are contextually added, or living under different binary names (like python3).

If we assume that a Python binary is always going to be called python<something> and be a binary file, we can just search the entire system for files that match those criteria:

$ sudo find / -type f -executable -iname 'python*' -exec file -i '{}' \; | awk -F: '/x-executable; charset=binary/ {print $1}' | xargs readlink -f | sort -u | xargs -I % sh -c 'echo -n "%: "; % -V'
/home/oli/venv/bin/python: Python 2.7.4
/media/ned/websites/venvold/bin/python: Python 2.7.4
/srv/chroot/precise_i386/usr/bin/python2.7: Python 2.7.3
/srv/chroot/trusty_i386/usr/bin/python2.7: Python 2.7.6
/srv/chroot/trusty_i386/usr/bin/python3.4: Python 3.4.0
/srv/chroot/trusty_i386/usr/bin/python3.4m: Python 3.4.0
/usr/bin/python2.7: Python 2.7.6
/usr/bin/python2.7-dbg: Python 2.7.6
/usr/bin/python3.4: Python 3.4.0
/usr/bin/python3.4dm: Python 3.4.0
/usr/bin/python3.4m: Python 3.4.0
/web/venvold/bin/python: Python 2.7.4

It's obviously a pretty hideous command but this is again real output and it seems to have done a fairly thorough job.

Answer from Oli on askubuntu.com
🌐
Note.nkmk.me
note.nkmk.me › home › python
Check Python Version on Command Line and in Scripts | note.nkmk.me
April 23, 2025 - ... For related topics, such as checking the version of installed packages or your operating system, see the following articles. ... Run the python or python3 command with the --version or -V option in the Command Prompt (cmd) on Windows or ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › check-the-version-of-the-python-interpreter
How to check Python Version : Windows, Linux and Mac - GeeksforGeeks
December 17, 2025 - In this guide, we'll explore various straightforward methods on how to check the Python version on your Linux, Windows, and Mac systems. To check the Python version on Windows or a Mac system, we can follow these methods: ... Open the Command Prompt for Windows by searching for "cmd" in the Windows Start menu, or open Terminal for Mac by searching "terminal" in the macOS spotlight search.
Discussions

Which version of Python do I have installed? - Stack Overflow
Typing python -V into the Command Prompt should display the version. ... There are two simple ways to check for the version of Python installed. ... Just create a file ending with .py and paste the code below into and run it. #!/usr/bin/python3.6 import platform import sys def linux_dist(): ... More on stackoverflow.com
🌐 stackoverflow.com
checking the python version on the machine
More likely python3 on a linux distribution. What do you get for, python --version and python3 --version? More on reddit.com
🌐 r/learnpython
3
2
March 13, 2023
How do I check which version of Python is running my script? - Stack Overflow
How do I check which version of the Python interpreter is running my script? See Find full path of the Python interpreter (Python executable)? if you are looking to find exactly which interpreter... More on stackoverflow.com
🌐 stackoverflow.com
linux - How to check all versions of Python installed on OS X and CentOS - Stack Overflow
I just started setting up a CentOS server today and noticed that the default version of Python on CentOS is set to 2.6.6. I want to use Python 2.7 instead. I googled around and found that 2.6.6 is ... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

How do I check the Python version in Linux?
Run `python3 --version` in the terminal. This prints the installed Python 3 version. If you have multiple versions installed, you may also try `python --version` to see which version the default `python` command points to.
🌐
linuxize.com
linuxize.com › home › python › how to check python version
How to Check Python Version | Linuxize
How to check the Python version on CMD?
To check the Python version in Windows Command Prompt, open CMD and enter “python --versionorpython -V.” These commands will display the Python version that is installed on your system. Additionally, if you have multiple Python versions installed on your system, you may need to use the “python3 --versioncommand to display the installed version of Python 3.
🌐
superops.com
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
How do I check all my Python versions?
If you have multiple Python versions installed on your computer, and you want to check them all, follow these steps:\n1\n.\n For Windows users\n-Open Command Prompt or PowerShell and run the command “where python.”\n-This command will list all the python.exe paths found in directories listed in your system’s PATH environment variable.\n-After finding all Python executables or paths, you can check the version of each separately.\n-If you have Python Launcher installed on your system, run the command “py -0”\n-This prints all Python versions the launcher can detect.\n2. For Linux and MacOS users
🌐
superops.com
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
🌐
SuperOps
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
5 days ago - Here are several effective ways ... by searching “Terminal” in the Spotlight search. In Linux OS, simply press the Ctrl+Alt+T ......
Top answer
1 of 9
116

You can use python -V (et al.) to show you the version of Python that the python command resolves to. If that's all you need, you're done. But to see every version of python in your system takes a bit more.

In Ubuntu we can check the resolution with readlink -f $(which python). In default cases in 14.04 this will simply point to /usr/bin/python2.7.

We can chain this in to show the version of that version of Python:

$ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: "; % -V'
/usr/bin/python2.7: Python 2.7.6

But this is still only telling us what our current python resolution is. If we were in a Virtualenv (a common Python stack management system) python might resolve to a different version:

$ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: "; % -V'
/home/oli/venv/bin/python: Python 2.7.4

This is real output.

The fact is there could be hundreds of different versions of Python secreted around your system, either on paths that are contextually added, or living under different binary names (like python3).

If we assume that a Python binary is always going to be called python<something> and be a binary file, we can just search the entire system for files that match those criteria:

$ sudo find / -type f -executable -iname 'python*' -exec file -i '{}' \; | awk -F: '/x-executable; charset=binary/ {print $1}' | xargs readlink -f | sort -u | xargs -I % sh -c 'echo -n "%: "; % -V'
/home/oli/venv/bin/python: Python 2.7.4
/media/ned/websites/venvold/bin/python: Python 2.7.4
/srv/chroot/precise_i386/usr/bin/python2.7: Python 2.7.3
/srv/chroot/trusty_i386/usr/bin/python2.7: Python 2.7.6
/srv/chroot/trusty_i386/usr/bin/python3.4: Python 3.4.0
/srv/chroot/trusty_i386/usr/bin/python3.4m: Python 3.4.0
/usr/bin/python2.7: Python 2.7.6
/usr/bin/python2.7-dbg: Python 2.7.6
/usr/bin/python3.4: Python 3.4.0
/usr/bin/python3.4dm: Python 3.4.0
/usr/bin/python3.4m: Python 3.4.0
/web/venvold/bin/python: Python 2.7.4

It's obviously a pretty hideous command but this is again real output and it seems to have done a fairly thorough job.

2 of 9
68

Type following in the terminal (Ctrl+Alt+T):

python -V

or

python --version

You can find a list of options/parameters for many commands in the terminal by typing the command followed by --help

Example:

python --help

Manual/manpages also available for most of such CLI which can be displayed by man <command> (Ex: man python)

From man python:

COMMAND LINE OPTIONS
        -V ,  --version
              Prints the Python version number of the executable and exits.

There is also python3 installed on many machines, so you can do:

python3 --version

to find out what python 3.x you are running.

🌐
DataCamp
datacamp.com › tutorial › check-python-version
How to Check Python Version: Windows, macOS, and Linux | DataCamp
January 28, 2026 - You can run python --version or python3 --version in the terminal to check the Python version. If you are using macOS or Linux systems, python and python3 commands often refer to separate Python installations.
Find elsewhere
🌐
LinuxConfig
linuxconfig.org › home › check python version
Check Python Version: Command & Script Methods
May 3, 2018 - Once ready run the check-python-version.py script to obtain python version. Make sure to use appropriate Python interpreter such as python or python3. ... From the above commands we can determine the system’s python version is 2.7.15 and 3.6.5 for both, Python 2 and Python 3 respectively. Python Version revealed on the Ubuntu Linux System
🌐
Red Hat
access.redhat.com › solutions › 1126333
How to check what python version is running on the system - Red Hat Customer Portal
I registered a particular server with Redhat Software Collectiona and installed Python33: # yum install python33 But when running the following command, I still get the Python 2.6.6 version: [root@server Python-3.4.1]# python -V Python 2.6.6 ...
🌐
Linuxize
linuxize.com › home › python › how to check python version
How to Check Python Version | Linuxize
1 month ago - To find out which version of Python is installed on your system, run the python3 --version or python3 -V command: ... On some systems, the python command still points to Python 2. Always use python3 explicitly to ensure you are checking the ...
🌐
Reddit
reddit.com › r/learnpython › checking the python version on the machine
r/learnpython on Reddit: checking the python version on the machine
March 13, 2023 -

while installing pyton and vscode on my linuxbox i run a test

well i allway thought that the test of python

[martin@martinsendeavour ~]$ which python /usr/bin/python [martin@martinsendeavour ~]$

well i get back this

[martin@martinsendeavour ~]$ which python 

/usr/bin/python [martin@martinsendeavour ~]$

i guess that this is not normal - i have no python on the machine!?

do i

🌐
How to Use Linux
howtouselinux.com › home › 3 ways to check python version in linux
3 Ways to Check Python Version in Linux - howtouselinux
October 9, 2025 - The following commands can be used to get Python version in Linux. ... To check Python version in Linux, you can use python -V command. All you need is to open the terminal then type python -V in the prompt. The Python version will be listed.
🌐
Cantech
cantech.in › home › how to check python version on windows, linux, and macos
How to Check Python Version on Windows, Linux, and MacOs
July 24, 2024 - To check the Python version in the cmd, you need to follow the below instructions: For Windows – Open the Command Prompt and type python –version or python -V, then press Enter.
🌐
LinuxConfig
linuxconfig.org › home › how to check python version on ubuntu 26.04
How to Check Python Version on Ubuntu 26.04
January 29, 2026 - How do I check which Python version a specific script will use? Check the shebang line at the top of the script. A line like #!/usr/bin/env python3 indicates Python 3, while #!/usr/bin/python2 specifies Python 2. You can also run which python3 to see the exact path of the Python interpreter that will be used when you execute commands. ... Support LinuxConfig...
🌐
Syncro
syncrosecure.com › home › blog › how to check python version
How to Check Python Version | Syncro
April 25, 2025 - For Windows: Use the “winget” command or check Python via the Apps & Features settings. For Linux: apt list –installed | grep python (for detailed version management, use “dpkg-query -l | grep python”)
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check python version in linux, windows, and macos
How to Check Python Version in Windows, Linux, and macOS
December 19, 2025 - Since most Linux versions now use Python 3 by default, we use python3 in the command syntax. However, if you still use Python 2 for some applications, omit 3 from the command to check which Python 2 version you have installed:
🌐
RoseHosting
rosehosting.com › home › how to check python version on linux
How to Check Python Version on Linux | RoseHosting
June 10, 2024 - For the older Python version, for Python 2 installations, you can type the following command in the terminal: ... This will display the installed Python version, such as Python 2.7.18. To check the version the installed Python3 version, open your terminal or command prompt and type the following command:
🌐
UltaHost
ultahost.com › knowledge-base › check-python-version-linux-windows
How to Check Python Version in Linux & Windows | Ultahost Knowledge Base
November 30, 2024 - You can check the Python version in Linux by opening a terminal and typing python –version or python -V. Alternatively, you can also use python3 –version or python3 -V depending on your Python installation.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › python › how to find python version on linux or unix
How To Find Python Version on Linux or Unix - nixCraft
March 27, 2023 - I find the version of Python installed on my server by running the following command in a terminal or command prompt over ssh session: python --version python2 --version python3 --version · PS: This is tested on RHEL 9. ... Use HTML <pre>...</pre> ...