6 Simple Ways to Check Your Python Version - An Easy-to-Follow Guide for Beginners
Have you ever encountered a sudden error while coding, or a library you're trying to use doesn't install? In these situations, the first thing you'll want to do is to use the Python Verify versionis required. Different versions of Python have different supported features and syntax, so it's very important to use the correct version.
In this guide, we'll use the 6 Simple Ways to Check Your Python Versionin Python. We'll cover different ways to check versions from the command prompt, to IDEs, to inside your code, and finally, we'll discuss the importance of Python versioning and how it can be applied in a real-world development environment. Make sure to read through to the end!
1. check your Python version at a command prompt

This method is the most basic and can be used on any operating system (Windows, macOS, Linux).
- Command Prompt(Windows) or Terminal (macOS, Linux). If you need further clarification on this part, see the box below.
- Enter the command below
python --version- Press Enter and you will see the installed Python version. If
pythonis not recognized,python3in the following example.
python3 --versionTo open a command prompt (Windows) or terminal (macOS, Linux)
1. open a command prompt in Windows
Use the Start menu: Click the Start button (Windows logo) in the lower left corner of the screen. In the search bar, type cmd or command prompt. Click the command prompt that appears in the search results to run it.
Use a keyboard shortcut: On your keyboard, press the Windows key and the R key simultaneously. In the Run window that appears, type cmd, and then press Enter.
Run as administrator (if necessary): After using the search method above, right-click the command prompt.
You can open it by selecting Run as administrator.
2. open Terminal on macOS
Use spotlight search: Click the magnifying glass icon (spotlight search) in the upper-right corner of the screen. Type terminal in the search bar, and click Terminal in the results.
Open from the Applications folder: Click the Finder icon (smiley face) in the Dock at the bottom of the screen. Select the Applications folder in the left sidebar. Navigate to the Utilities folder, find Terminal, and run it.
3. open the terminal on Linux
Use keyboard shortcuts: Typically, pressing Ctrl + Alt + T at the same time will open Terminal.
Use the application menu: Click the application menu in the bottom left or top left corner of the screen. Type Terminal in the search bar, then click the Terminal icon that appears.
Desktop shortcuts: Depending on your desktop environment, you can click directly on the screen to launch a terminal shortcut.
Tips for using the command prompt, How to extract a list of folder files using CMD commands (feat. Powershell)as well!
2. check the version in the Python interactive shell

You can check the version by running the Python interactive shell.
- At a command prompt or terminal, type
pythonorpython3to launch the interactive shell. - When the shell starts, you'll see Python version information at the top.
- Additionally, you can get more information by entering the following commands
import sys
print(sys.version)3. Check your Python version in your IDE

Many developers use IDE(integrated development environment) to code. PyCharmand Visual Studio Codeto check the Python version. The version checked here is different from the ones above because we used a virtual environment (myenv).
PyCharm
- Run PyCharm and look at the bottom status bar.
- On the right, you'll see information about the Python interpreter that your project is currently using. You can click to see more detailed information.
Visual Studio Code
- VS Codeand open the python file.
- In the lower left corner, you'll see information about the selected Python interpreter. You can click this information to switch to a different version.
4. Check the Python version within your code
There are times when you need to check the Python version while running code. Here are two methods you can use to do so.
Using the sys module
import sys
print(sys.version)
Using the platform module
import platform
print(platform.python_version())
5. Check the Python version in the virtual environment
Virtual environments provide an independent Python environment for each project to avoid version conflicts. Here's how to check the version in a virtual environment
With the virtual environment enabled, enter the following command
- Windows:
venv\\Scripts\\activate - macOS/Linux:
source venv/bin/activate
python --version6. Check the Python version using pip

pipis a Python package manager. You can check the version of Python installed with pip by running the following command
pip --versionThe importance of Python versioning
Here's why version control is important
- Compatibility: Certain libraries or frameworks only work with certain versions of Python.
- Feature differences: The new version brings new features and performance improvements.
- Security issues: Older versions may contain security vulnerabilities.
- Bug fixes: The new version fixes the previous bug.
Python versioning tips for real-world development environments
- Using virtual environments: Provide independent environments for each project to avoid version conflicts.
- Utilize version control tools:
pyenvIcondato effectively manage multiple versions. - Maintain the requirements.txt file: Recreate your environment by specifying the libraries and versions used by your project.
- Include version checks in your CI/CD pipeline: Add Python version checks to your tests to improve reliability.
Organize
Checking your Python version is simple, but it plays an important role in the development process. With the six methods in this article, you can easily check your Python version in a variety of situations and ensure you're developing with the right version.
The world of Python is constantly evolving. Stay up to date and become a better Python developer with proper version control!
# Glossary
- VersionVersion is a number generated each time the software is updated, usually in the form "major version.minor version.revision" (e.g. 3.10.5). Python versions include new feature additions, security updates, bug fixes, and more.
- Command Line Interface (CLI)The CLI is a way to interact with your computer through text commands. It's commonly called the "command prompt" or "terminal" and is used to check your Python version or run certain programs.
- Command Prompt / Terminal (Command Prompt / Terminal)The Command Prompt is the program that allows you to use the CLI on Windows operating systems. Terminal is the default application for working with the CLI on macOS and Linux.
- Virtual Environment: Virtual environments create independent Python environments for specific projects to avoid version conflicts and allow you to manage packages that depend on them separately across projects. They are typically created with tools like venv or conda.
- pip: pip is Python's package manager, used to install, update, and delete various libraries (external modules) required by Python. You can check the installed Python version information with the pip -version command.
- Integrated Development Environment (IDE)An IDE is a program that combines several functions into one, including code editing, debugging, and version control. PyCharm, Visual Studio Code, and others are common Python IDEs, and you can easily see which version of Python you're using in each project.
- sys module:sys is one of Python's standard library modules that provides information about your system, and you can check your Python version with sys.version.
- platform moduleplatform is a module that provides platform-specific information about Python. platform.python_version() can be used to get the version of Python currently running.






