How to Check Python Version On The Command-Line

Not sure what Python version you’re running? In this short how-to, you’ll learn how to check your Python version. You don’t want to be running an old version unintentionally, even though you just installed the latest! Yes, this happens. It’s easy to check your Python version, so let’s do that.

This simple command works on all operating systems, including Windows, Linux, and MacOS. Assuming you have Python installed, and the terminal open, you can check your current Python version with the following command:

$ python --version
Python 2.7.16

Hopefully, yours says something like 3.7.x or higher. But if it says 2.7.x (or lower), don’t worry just yet. On many systems, both versions of Python are installed. Usually, Python 2 runs when you enter python and Python 3 when you enter python3.

Try it:

$ python3 --version
Python 3.7.6

If your output looks similar, congratulations. You have Python 3 installed! If not, please follow the steps on installing Python 3.

About the author

Erik is the owner of Python Land and the author of many of the articles and tutorials on this website. He's been working as a professional software developer for 25 years, and he holds a Master of Science degree in computer science. His favorite language of choice: Python!