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 the Python version, so let’s do that.

Check Python version

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.

There have long been two versions of Python: version 2 and 3. They existed alongside, as explained in our article on Python’s history.

On many systems, both versions of Python are installed. This happens when some pieces of software require version 2, while to OS or the user also needs three. In such cases, usually, Python 2 runs when you enter python and Python 3 when you enter python3.

Let’s check the Python version again, but now try with python3:

$ 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 for your operating system.

Get certified with our courses

Our premium courses offer a superior user experience with small, easy-to-digest lessons, progress tracking, quizzes to test your knowledge, and practice sessions. Each course will earn you a downloadable course certificate.

Learn more

This article is part of the free Python tutorial. You can head over to the start of the tutorial here. You can navigate this tutorial using the buttons at the top and bottom of the articles. To get an overview of all articles in the tutorial, please use the fold-out menu at the top.

If you liked this article, you might also like to read the following articles:

Leave a Comment

Python Newsletter

Before you leave, you may want to sign up for my newsletter.

Tips & Tricks
News
Course discounts

Googler exit intent popup

No spam & you can unsubscribe at any time.

Share to...