Python is one of the most popular programming languages, you may want to know what version of Python has been installed on your system, in this article we will check how you can identify that,
Table of Content:
- How to check installed Python version in Windows OS?
- How to check installed Python version in macOS?
- How to check installed Python version in Linux?
- Unknown Option: -e Error while checking Python version
How to check installed Python version in Windows OS?
- How to check installed Python version in Windows OS?
- How to check installed Python version in macOS?
- How to check installed Python version in Linux?
- Unknown Option: -e Error while checking Python version
How to check installed Python version in Windows OS?
If you are on a Windows Operating system, you can try the below steps,
- Press Ctrl + R to Open RUN and type CMD or Powershell or Bash to open Terminal/Command Prompt.
- Now type python -V or python --version
C:\Users\pythonDev>python --version Python 3.8.6rc1
C:\Users\pythonDev>python --V Python 3.8.6rc1
So as you can see I am using 3.8.6 where 3 => Major version, 8 => Minor version, and 6 => Macro Version, rc stands for release candidate (yet not released for production use)
- You can also use Python Shell to get more details:
Python 3.8.6rc1 (tags/v3.8.6rc1:08bd63d, Sep 7 2020, 23:10:23) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> import sys >>> print(sys.version) 3.8.6rc1 (tags/v3.8.6rc1:08bd63d, Sep 7 2020, 23:10:23) [MSC v.1927 64 bit (AMD64)]
Note: If you are using Windows 10 and you do not have Python installed on your System, just type python in the command prompt at it will open up Microsoft Store with Python 3.8 page were you can easily get Python installed.
Python -V was introduced in Python 2.5+, so if you are using an older version, this command may not work!
-V : print the Python version number and exit (also --version)
when given twice, print more information about the build
How to check installed Python version in macOS?
⛏️ Python comes pre-installed with macOS, so you do not need to install it separately unless you want to upgrade to a new version, or have to use multiple Python versions at a time.
- Go to Finder -> Application -> Utilities
- Open Terminal
- Type python --version or python -V to check the version:
pythonDev: $ python --version Python 3.8.1
How to check installed Python version in Linux?
⛏️ Again like macOS, Python usually comes pre-installed with the latest versions of Linux flavors, so you do not need to install it separately unless you want to use multiple Python versions at a time.
- Open Terminal: You can do that by pressing Ctrl + Alt + T key combinations
- Type python --version or python -V to check the version:
linuxBox: $ python --version Python 3.8.7
Unknown Option: -e Error while checking Python version
If you type the command incorrectly, single hyphen instead of two you will get the below message!
C:\Users\pythonDev>python -version
Unknown option: -e
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
Frequently Asked Questions (FAQs):
How to Check Python Version on Windows:
- Open Command Prompt.
- Type
python --version
orpython -V
. - Press Enter to display the installed Python version.
How to Verify Python Version on Windows:
- Use Command Prompt.
- Execute
python --version
orpython -V
command. - The installed Python version will be shown.
Finding Python Version on Windows:
- Go to Command Prompt.
- Enter
python --version
orpython -V
. - The Python version is displayed.
Checking Python Version via Command Prompt (Windows):
- Open Command Prompt.
- Run
python --version
orpython -V
command. - Your Python version will be shown.
Linux Python Version Command:
- In a terminal, use
python --version
orpython -V
. - This displays the Python version on Linux.
- In a terminal, use
Determine Python Version on Linux:
- In a Linux terminal, execute
python --version
orpython -V
. - The installed Python version is revealed.
- In a Linux terminal, execute
Terminal Command for Checking Python Version (Linux):
- In the terminal, use
python --version
orpython -V
. - The Python version is displayed.
- In the terminal, use
Identifying Python Version on macOS:
- Open macOS Terminal.
- Type
python --version
orpython -V
. - Press Enter to see the installed Python version.
Checking Python Version in macOS Terminal:
- Use macOS Terminal.
- Execute
python --version
orpython -V
command. - Your Python version will be shown.
Methods for Checking Python Version on Different OS:
- Windows, Linux, and macOS use the same
python --version
orpython -V
commands in their respective terminals.
- Windows, Linux, and macOS use the same
Checking Multiple Python Versions Simultaneously:
- Yes, multiple Python versions can coexist on your system. Use version-specific commands like
python2 --version
orpython3 --version
.
- Yes, multiple Python versions can coexist on your system. Use version-specific commands like
Output of "python -V" Command:
- "python -V" displays the installed Python version, for example, "Python 3.8.2".
Checking Python 2.x and 3.x Versions:
- Use
python2 --version
orpython3 --version
to check Python 2.x and 3.x versions separately.
- Use
Recommended Way for Scripting:
- The
sys
module in Python allows you to script version checks usingsys.version
.
- The
Checking Python Version with a Script:
- Yes, you can create a Python script to programmatically check the installed Python version using
sys.version
.
- Yes, you can create a Python script to programmatically check the installed Python version using
GUI Tools for Checking Python Versions:
- Yes, there are GUI tools like "Python Launcher" for macOS and "Python Launcher for Windows" to check and manage Python versions.
What to Do If Python Isn't Installed:
- Download the latest Python version from the official website and follow installation instructions.
Upgrading or Downgrading Python:
- Use the official Python installer to upgrade or downgrade Python to a specific version.
Checking the Latest Python Version:
- Visit the Python official website to find the latest version and download it if needed.
Importance of Checking Python Version:
- Regular version checks ensure compatibility with scripts and packages, and help you stay up to date with the latest features and security updates.
Comments:
- This was helpful... Thanks
user: anonymous 03 Oct 2020 11:10:28 GMT
- Further comments disabled!
Facing issues? Have Questions? Post them here! I am happy to answer!
- Python List of Lists with Examples
- Fix: ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none) ERROR: No matching distribution found for tkinter
- How to Convert Python Notebook .ipynb (JSON) to Executable .py Module
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- Python: Pandas Merge Indicator (Left, Right and Both) Example
- Fix: EOFError Exception in Python
- How to URL Decode a Query String in Python
- How to take user input from the console in a Python program
- Compare two lists in Python and return matches
- How to change the Python Default version
- Fix: KeyError: exception in Python
- How to get the Execution Time of A Python Program
- Fix: ModuleNotFoundError: No module named boto3 [Python]
- How to get unique values from a list in Python
- How to pip install Python Modules in VSCode
- Python: Fix - TypeError: NoneType object is not iterable
- How to delete a file using Python code example
- How to create a dictionary comprehension in Python
- Python: Get just the filename without extension using Path
- How to comment out a block of code in Python
- How to add two float numbers in Python
- Python: How to POST Json Data with HTTP Request
- Get MD5 Hash as Checksum of a String in Python
- Python - Convert float to String
- How to Parse XML String in Python
- PHP.ini: How to Remove URL Forward Slash Before Single or Double Quotes - PHP
- How to convert a Excel to PDF file in Mac - MacOS
- How to install iTerm2 - Terminal alternative for Mac - MacOS
- Encode or Decode Base64 String using Mac Terminal Command - MacOS
- How to install fps unlocker for Roblox on Mac - MacOS
- How to uninstall/remove or disable Microsoft Teams - Teams
- How to use a different Python version with virtualenv - Python
- Java: Round Up to 2 decimal places examples - Java