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
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.

🌐
Quora
quora.com › How-do-you-check-if-Python-is-installed-in-Ubuntu
How to check if Python is installed in Ubuntu - Quora
On modern Ubuntu this may be absent or symlinked to python3; output example: Python 3.11.0 or command not found. ... If empty, no top-level python command in PATH. ... Lists installed Python 3 package(s) provided by APT. ... Reveals whether python points to python3 and the exact binary. ... Produces path and exact version (useful for virtualenv/pyenv detection).
Discussions

python - How do I detect the Ubuntu version? - Stack Overflow
I'm currently writing a Python app that changes some network configuration files. The app needs to run on Ubuntu 10.04 to 13.10. The problem is, that NetworkManager is broken in different ways on More on stackoverflow.com
🌐 stackoverflow.com
Install python 3.11.9 on ubuntu
According to this page: 'Python 3.11.9 is the newest major release of the Python programming language". Can I install Python 3.11.9 in my Virtual Machine? I have installed guest VM ubuntu-22.04.4-desktop-amd64.iso on a Windows 10 host. In the VM, I have run the following: sudo apt install sudo ... More on discuss.python.org
🌐 discuss.python.org
12
1
April 16, 2024
How to allow Python to know I'm on Windows?
If you want python to "know" you are running from Windows, then you need to actually run inside Windows. If you launch python from WSL, then you are in Linux More on reddit.com
🌐 r/bashonubuntuonwindows
5
1
March 19, 2018
Linux Python devs, what distro do you use and why?
I always feel like such a basic bitch when answering this question. I'm nearly 20 years into Unix/Linux and I always end up on Ubuntu for local dev/home servers. I move the task bar to the bottom, resize it and use the rest as default. Production cloud can be either Ubuntu or Alpine (Centos when requested). More on reddit.com
🌐 r/Python
258
205
April 13, 2019
People also ask

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 --version” command 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
How to check if Python is installed on Windows?
To check if Python is installed on Windows, open Command Prompt and type “python --version.” If Python is installed and added to your system’s PATH, the command will display the installed Python version. If you get an error saying the command is not recognized, Python is either not installed or not added to the PATH.
🌐
superops.com
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
🌐
Greenwebpage
greenwebpage.com › home › blog › how to check and update the python version on ubuntu 24.04
How to Check and Update the Python Version on Ubuntu 24.04
April 4, 2025 - Using DeadSnakes PPA Method 4: Compile Python from Source Conclusion How to Check and Update the Python Version on Ubuntu 24.04 To check and update Python on Ubuntu 24.04, use python3 --version to check the current version, and update via ...
🌐
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 - Learn how to check your Python version in several different operating systems, including Windows, Linux, and macOS.
🌐
freeCodeCamp
freecodecamp.org › news › check-python-version-how-to-check-py-in-mac-windows-and-linux
Check Python Version – How to Check Py in Mac, Windows, and Linux
July 7, 2023 - You can typically find it in the applications menu or by using a keyboard shortcut such as Ctrl+Alt+T. In the terminal, type the following command and press Enter: ... This command will display the Python version installed on your system.
Find elsewhere
🌐
SuperOps
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
2 days ago - 1. You can use the "Winget" command. 2. You can also check through "Apps & Features" in the system settings of Python. 1. For Debian-based systems like Ubuntu, use the command “apt show python3” ·
🌐
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 - You can also check the version tuple programmatically: $ python3 -c "import sys; print(sys.version_info)" The output shows a named tuple with major, minor, micro, release level, and serial components. This format is particularly useful when you need to perform version comparisons in scripts. Displaying detailed Python version information using sys.version_info · Ubuntu 26.04 ships with Python 3 as the default and recommended Python version.
🌐
GeeksforGeeks
geeksforgeeks.org › python › check-the-version-of-the-python-interpreter
How to check Python Version : Windows, Linux and Mac - GeeksforGeeks
December 17, 2025 - If you installed Python using a package manager, you can use these tools to check the Python version. For Debian-based systems, such as Ubuntu, you can use `apt`:
🌐
GitHub
github.com › pyenv › pyenv
GitHub - pyenv/pyenv: Simple Python version management · GitHub
Install Python build dependencies before attempting to install a new Python version. You can now begin using Pyenv. if you have upgraded from pyenv version 2.0.x-2.2.x ... The startup logic and instructions have been updated for simplicity in 2.3.0. The previous, more complicated configuration scheme for 2.0.0-2.2.5 still works. Define environment variable PYENV_ROOT to point to the path where Pyenv will store its data. $HOME/.pyenv is the default. If you installed Pyenv via Git checkout, we recommend to set it to the same location as where you cloned it.
Starred by 44.6K users
Forked by 3.2K users
Languages   Shell 86.9% | Python 10.8% | Makefile 1.5% | C 0.4% | Roff 0.2% | Dockerfile 0.2%
🌐
Syncro
syncrosecure.com › home › blog › how to check python version
How to Check Python Version | Syncro
April 25, 2025 - Many IT management tools and platforms that integrate with Python will display the version being used. For example: Ansible: Run the following command to check the Python interpreter: “ansible localhost -m setup | grep ansible_python_version”
🌐
bodHOST
bodhost.com › tutorial › how to check python version in linux & windows
How to Check Python Version in Linux & Windows | bodHOST
November 7, 2024 - py --version # Shows default Python version py -0 # Lists ALL installed Python versions py -3 # Runs latest Python 3 version · The Python Launcher (`py`) in Windows makes it easy to manage multiple Python versions.
🌐
CyberPanel
cyberpanel.net › blog › how-to-check-python-version
Quick Ways to Check Python Version on Mac, Windows & Linux
May 17, 2025 - Master how to check Python version on Mac, Linux, & Windows using terminal commands, Python scripts, the `sys` module, & the `py` launcher for a quick check.
🌐
Linuxize
linuxize.com › home › python › how to check python version
How to Check Python Version | Linuxize
March 10, 2026 - 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 ...
🌐
UltaHost
ultahost.com › knowledge-base › check-python-version-linux-windows
How to Check Python Version in Linux & Windows | Ultahost Knowledge Base
November 30, 2024 - This will display the complete version information, including the build number, compiler details, and other relevant information. To exit the Python interpreter, type exit() and press Enter. When checking the Python version, you may encounter some common issues.
🌐
Finxter
blog.finxter.com › check-ubuntu-python-version
Check Ubuntu Python Version – Be on the Right Side of Change
To verify the Python version in the Ubuntu terminal, simply type the following command and press Enter: python3 -V. This will display the version of Python currently installed on your system. ✅ · The command to check the Python version in Linux is the same as in Ubuntu: python3 -V.
🌐
Python.org
discuss.python.org › python help
Install python 3.11.9 on ubuntu - Python Help - Discussions on Python.org
According to this page: 'Python 3.11.9 is the newest major release of the Python programming language". Can I install Python 3.11.9 in my Virtual Machine? I have installed guest VM ubuntu-22.04.4-desktop-amd64.iso on a Windows 10 host. In the VM, I have run the following: sudo apt install sudo apt upgrade this: python3 --version returns: Python 3.10.12 When I run: sudo apt install python3 I receive this message: python3 is already at the newest version (3.10.6-1~22.04) When...
Published   April 16, 2024
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › reference › availability › python
Available Python versions - Ubuntu for Developers
1 week ago - This page lists Python versions available in Ubuntu releases. Ubuntu Python 3 (deb) packages:,,, Ubuntu version, available Python 3 versions, python3-defaults version,,, 25.10 (Questing Quokka), 3....
🌐
Learn Ubuntu
learnubuntu.com › check-python-version
How to Check Python Version in Ubuntu
November 25, 2023 - Learn how to quickly check the current Python version in use in Ubuntu Linux.