Which version of Python do I have installed?
Curious about which Python version is installed on your system? Learn how to check your Python version using quick commands, whether you're on Windows, macOS, or Linux!
If you're wondering which version of Python is installed on your computer, there are some easy ways to check it, whether you're on Windows, macOS, or Linux. Knowing your Python version is important, especially when you’re installing packages or troubleshooting compatibility issues.
Here are some quick methods:
Using the Command Line (Works on all OS)
Open your terminal or command prompt and type:
python --version
or
python3 --version
This will display the installed Python version, like Python 3.10.5.
Using Python Shell (REPL)
You can also enter the Python shell by typing:
python
Once inside, check the version with:
import sys
print(sys.version)
On Windows
If Python is added to your PATH, open Command Prompt and run:
py --version
On macOS/Linux
Use:
python3 --version
- If none of these work, it might mean Python isn’t properly installed, or it’s not added to your PATH. In that case, you may need to reinstall it.
- Checking your Python version is crucial because Python 2 and Python 3 have significant differences, and many packages require specific versions to work correctly!