Как посмотреть версию python windows

Last Updated :
22 Apr, 2025

Python has multiple versions, and it’s important to know which version is installed on your system. This information is crucial because different Python versions may have variations in syntax or libraries, and ensuring you’re using the correct version is vital for compatibility with your projects. In this guide, we’ll explore various straightforward methods on how to check the Python version on your Linux, Windows, and Mac systems.

How to Check Python Version on Windows and Mac

To check the Python version on Windows or Mac system, we can follow these methods:

  • Using the Command Prompt/Terminal
  • Checking in the Interactive Shell

Using the Command Prompt/Terminal

Open the Command Prompt for Windows by searching for “cmd” in the Windows Start menu or open Terminal for Mac by searching Terminal in the MacOS spotlight search.  Then, use one of the following commands:

For Python 2:

python –version
or
python -V

For Python 3:

python3 –version
or
python3 -V

pythonVersion

python Version using Command Prompt

Using Interactive Shell

We can also find the Python version in the interactive shell. Open the Command Prompt/terminal and enter one of the following commands:

For Python 2:

python

For Python 3:

python3

Once you are in the Python interactive shell, you can check the version with these Python commands:

import sys
print(sys.version)

pythonVersionUsingShell

Python Version Using Interactive Shell

How to Check Python Version on Linux

We can use the following methods to check the Python version on Linux systems like Ubuntu, Debian, Arch, etc. These methods can be used to find Python version:

  • Using the Command Line
  • Checking in the Interactive Shell
  • Using Package Managers
  • Checking the Path

Check the Python Version Using the Command Line

The command line provides a straightforward way to get the Python version. Open your terminal and use this simple check Python version command:

For Python 2:

python –version
or
python -V

For Python 3:

python3 –version
or
python -V

Checking python version in Linux

Check Python Version Using the Command Line

NOTE: These commands will display the Python version installed on your Linux system.

Check Python Version Using Interactive Shell

Python’s interactive shell is another way to find Python version. Open your terminal and enter one of the following commands:

For Python 2:

python

For Python 3:

python3

Once you are in the Python interactive shell, you can get Python version with the following Python commands:

import sys
print(sys.version)

Checking python version in Linux

Checking Python Version in the Interactive Shell

Check Python Version Using Package Managers

If you installed Python using a package manager, you can use these tools to check the Python version.

For Debian-based systems, such as Ubuntu, you can use `apt`:

apt show python3

Checking python version in Linux

Check Python Version Using Package Managers

For Red Hat-based systems, like CentOS, you can use yum:

yum info python3

NOTE: These commands will provide detailed information about the Python version installed on your system.

Finding Python Version by Checking the Path

We can also determine the path to the Python interpreter and indirectly obtain information about the installed version using the `which` command:

which python3

This command will return the path to the Python interpreter. We can then use this path to check the version:

/path/to/python –version

Replace ‘/path/to/python’ with the actual path obtained from the previous which command.

checking with path

Finding Python Version by Checking the Path

Also Read:

  • Download and Install Python 3 Latest Version
  • How to update Python on Windows?
  • How to Download and Install Python Latest Version on Linux

  1. Step 1 Откройте строку поиска.

    Если ее нет на панели задач, щелкните по значку лупы у

    Windows Start

    или нажмите Win+S.

  2. Step 2 Введите python в строке поиска.

    Откроются результаты поиска.

  3. Step 3 Нажмите Python [командная строка].

    Откроется черное окно командной строки с приглашением Python.

  4. Step 4 Найдите версию в первой строке.

    В левом верхнем углу окна отобразится слово «Python», а справа от него — версия Python (например, 2.7.14).

    Реклама

  1. Step 1 Откройте терминал.

    Для этого откройте окно Finder и нажмите «Программы» > «Утилиты» > «Терминал».

  2. Step 2 Введите python -V в терминале.

  3. Step 3 Нажмите ⏎ Return.

    Версия Python отобразится под словом «Python» (например, 2.7.3).

    Реклама

Об этой статье

Эту страницу просматривали 68 327 раз.

Была ли эта статья полезной?

Пройдите тест, узнайте какой профессии подходите

Очень важно знать, какая версия Python установлена на вашем компьютере, особенно если вы работаете над проектом, который требует определенной версии.

Очень важно знать, какая версия Python установлена на вашем компьютере, особенно если вы работаете над проектом, который требует определенной версии. Версия Python может влиять на работу кода, так как разные версии могут иметь различные функции и библиотеки. Например, у вас может быть установлена версия Python 2.7, но вы хотите использовать функции, доступные только в Python 3.6. В этом случае вам нужно будет обновить Python до версии 3.6.

Освойте Python на курсе от Skypro. Вас ждут 400 часов обучения и практики (достаточно десяти часов в неделю), подготовка проектов для портфолио, индивидуальная проверка домашних заданий и помощь опытных наставников. Получится, даже если у вас нет опыта в IT.

Узнайте свою версию Python

Есть несколько способов узнать версию Python на вашем компьютере. Но самый простой и надежный из них — это использовать командную строку.

Для пользователей Windows

Откройте командную строку, нажав клавиши Windows + R, затем введите cmd и нажмите Enter.

В командной строке введите python --version и нажмите Enter. Система должна показать версию Python, установленную на вашем компьютере.

Для пользователей MacOS и Linux

Откройте Терминал.

В терминале введите python3 --version и нажмите Enter. Система должна показать версию Python, установленную на вашем компьютере.

На курсе Skypro «Python-разработчик» освоите основные инструменты программирования, получите опыт на реальных проектах и сможете стартовать в профессии уверенным новичком. Преподаватели — практикующие программисты с большим опытом, а в центре карьеры помогут составить цепляющее резюме и подготовиться к собеседованию.

Обновление Python

Если вы хотите обновить свою версию Python, вы можете скачать последнюю версию с официального сайта Python. Помните, что обновление Python может повлиять на некоторые из ваших существующих проектов, которые зависят от старых версий Python. Поэтому всегда рекомендуется создать резервную копию ваших проектов перед обновлением Python.

В любом случае, знание версии Python на вашем компьютере поможет вам писать более эффективный код и избегать проблем совместимости.

Check Python Version – How to Check Py in Mac, Windows, and Linux

By Shittu Olumide

Python is a versatile and widely used programming language known for its simplicity and readability.

With its ever-evolving nature, different versions of Python are often released, each offering new features, enhancements, and bug fixes.

As a Python developer, it is crucial to be aware of the Python version you are using, as it determines the compatibility of libraries, syntax, and functionalities.

In this article, we will explore various methods to check the Python version installed on your system. Whether you are a beginner starting your Python journey or an experienced developer working on a project, knowing your Python version is the first step towards ensuring smooth execution and compatibility.

We will dive into the command-line approaches to determine the Python version. By the end of this article, you will be equipped with the knowledge to effortlessly check your Python version and make informed decisions regarding the tools and libraries you can utilize.

To check the Python version on a Mac, you can follow these steps:

Open the Terminal application on your Mac:

You can find the terminal by navigating to «Applications» -> «Utilities» -> «Terminal«, or by using Spotlight search (Cmd + Space) and typing «Terminal«.

Once the Terminal is open, you will see a command prompt where you can enter commands. Type the following command and press Enter:

python --version

This command will display the Python version installed on your Mac. For example, if you have Python 3.9.2 installed, it will display something like:

Python 3.9.2

The version number will vary depending on the specific Python installation on your system.

Alternative methods for Mac

If the python --version command does not work, try using the python3 command instead. Python 3 is the latest major version of Python, and some systems have both Python 2 and Python 3 installed.

To check the Python 3 version, enter the following command and press Enter:

python3 --version

This command will display the Python 3 version installed on your Mac.

Another way to check the Python version is by using the sys module within the Python interpreter. In the Terminal, type the following command and press Enter to start the Python interpreter:

python

This will launch the Python interpreter, and you will see a new prompt (>>>) indicating that you can enter Python commands.

Within the Python interpreter, type the following command and press Enter:

import sys
print(sys.version)

This will print the detailed Python version information, including the version number and additional details such as the build number and the date of the Python installation.

After checking the Python version, you can exit the Python interpreter by typing exit() and pressing Enter, or by pressing Ctrl + Z followed by Enter.

By following these steps, you will be able to check the Python version installed on your Mac using the Terminal application.

How to Check Python Version in Windows

To check the Python version on a Windows operating system, you can follow these detailed steps:

Open the Command Prompt:

  • Press the Windows key on your keyboard.
  • Type «cmd» (without quotes) in the search bar.
  • Click on the «Command Prompt» app from the search results. This will open the Command Prompt window.

Check if Python is installed:

In the Command Prompt window, type the following command and press Enter:

python --version

If Python is installed on your system, it will display the version number. For example, «Python 3.9.2«.

If Python is not installed, you will see an error message stating that the command is not recognized. In this case, you need to install Python before proceeding.

Verify the Python installation location (optional):

In the Command Prompt, type the following command and press Enter:

where python

This command will display the path of the Python executable file. By default, Python is installed in the «C:\PythonXX» directory, where «XX» represents the version number.

If the command doesn’t return any result, it means Python is not installed or not added to the system’s PATH environment variable.

Check the Python version using the Python interpreter:

In the Command Prompt, type the following command and press Enter:

python

This will launch the Python interpreter, displaying the Python version information at the top. For example, «Python 3.9.2 (tags/v3.9.2:1a79785, Feb 22 2021, 12:26:58)«.

To exit the Python interpreter, you can type exit() and press Enter.

Check the Python version using IDLE (optional):

IDLE is an integrated development environment that comes bundled with Python.

In the Command Prompt, type the following command and press Enter:

idle

This will launch the IDLE Python Shell, which will display the Python version information at the top. For example, «Python 3.9.2 (tags/v3.9.2:1a79785, Feb 22 2021, 12:26:58)«.

To exit the IDLE Python Shell, you can go to the «File» menu and choose «Exit» or simply close the window.

By following these steps, you can easily check the Python version installed on your Windows system using the Command Prompt or Python interpreter.

How to Check Python Version in Linux

Open a terminal:

Launch the terminal application on your Linux system. You can typically find it in the applications menu or by using a keyboard shortcut such as Ctrl+Alt+T.

In the terminal, type the following command and press Enter:

python --version

This command will display the Python version installed on your system.

Note: Some Linux distributions, such as Ubuntu, may have both Python 2 and Python 3 installed. In that case, the above command may display the version of Python 2. To check the version of Python 3, you can use the following command:

python3 --version

Check the output:

After executing the command, the terminal will display the Python version installed on your system. It will typically be in the format «Python x.y.z», where x, y, and z represent the major, minor, and micro versions respectively.

For example, the output might be:

Python  3.9.2


This means Python version 3.9.2 is installed on your Linux system.

### Verify the installation:

To verify that the Python version displayed is correct, you can also enter the Python interactive shell by typing the following command and pressing Enter:

```bash
python

This will open the Python shell, where you can interactively execute Python commands.

Check the version from the Python shell:

In the Python shell, you can confirm the version by typing the following command and pressing Enter:

import sys
print(sys.version)

The output will display detailed information about the Python version, including the version number, build information, and additional details.

Exit the Python shell

To exit the Python shell, you can type exit() or press Ctrl+D.

By following these steps, you can easily check the Python version installed on your Linux system.

Conclusion

By following the instructions provided in this article, you can easily check your Python version whether you use Mac, Windows, or Linux. This will help you write your Python programs confidently.

Remember to consult the relevant documentation or community resources if you encounter any issues or if you are using non-standard Python distributions or virtual environments.

As Python continues to evolve, staying updated with the installed Python version becomes increasingly important. This knowledge lets you to take advantage of new features and improvements introduced in newer Python releases while ensuring compatibility with existing codebases.

Let’s connect on Twitter and on LinkedIn. You can also subscribe to my YouTube channel.

Happy Coding!


Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started

Python is a versatile and widely used programming language that has become an essential tool for developers, data scientists, and researchers. With its simplicity, flexibility, and extensive libraries, Python has become the language of choice for various applications, from web development and data analysis to artificial intelligence and machine learning. 

Knowing the version of Python installed on your system is crucial for various reasons. It helps ensure compatibility with libraries, frameworks, and third-party packages you might want to use in your projects. Additionally, some Python features and syntax may differ across versions, so being aware of the installed version can prevent potential issues and ensure smooth development. In this article, we’ll explore multiple methods to check the Python version on both Linux and Windows operating systems.

In this article, we’ll provide a comprehensive guide on how to check Python version in Linux and Windows operating systems. We’ll cover the different methods, including command-line instructions, and provide troubleshooting tips to help you overcome common issues.

Why Check the Python Version?

Before diving into the methods of checking Python versions, it’s essential to understand why it’s crucial to know the version of Python installed on your system. Here are a few reasons:

Compatibility

Different Python versions have varying levels of compatibility with libraries, frameworks, and third-party packages. Knowing the Python version ensures that you can use the required packages and libraries without compatibility issues.

Syntax Differences 

Python syntax and features change across versions. For example, Python 2.x uses the print statement, while Python 3.x uses the print() function. Being aware of the installed version helps you write code that’s compatible with your Python version.

Deprecation and Removal of Features 

As Python evolves, some features and modules are deprecated or removed. Knowing the Python version helps you avoid using deprecated features and plan for future updates.

Experience the power of Python Hosting

Ready to unlock the complete power of Python on Windows and Linux? Begin your development today with Ultahost’s Python hosting services!

Checking Python Version in Linux

Method 1: Using the Command Prompt

Linux is a popular operating system among developers. If you install Python in Ubuntu Linux, To check the Python version in Linux, you can use the following command:

python3  --version
python3-version

Another similar command that you can use to check the Python version is mentioned below:

python3 -V
python3-v

The output will display the Python version and any additional information, such as the build number or compilation date. If the command returns an error indicating that Python is not installed or recognized, you may need to install or update your Python installation.

Method 2: Using the Python Interpreter

Another method to see Python version is by launching the Python interpreter. Open your terminal and enter:

python3

Once the interpreter is running, Type the following command for Python version check:

import sys
print(sys.version)
license-for-more-information

This will print the complete version information, including the build number, compiler details, and other relevant information.

To exit the Python interpreter, simply type exit() and press Enter.

While this method provides more detailed version information, it requires launching the Python interpreter, which may not be desirable in certain situations.

Method 1: Using the Command Prompt

If you install Python in Windows, you can find Python version in Windows using the command prompt. Open the Command Prompt cmd.exe and enter the Python version command:

python  --version
python-3.12.3

Method 2: Using the Python Interpreter

Launch the Python interpreter by opening the Command Prompt and typing:

python

Once the interpreter is running, you can check the version by entering the following command:

import sys
print(sys.version)
credits-or-license

This will display the complete version information, including the build number, compiler details, and other relevant information.

To exit the Python interpreter, type exit() and press Enter.

Troubleshooting Common Issues

When checking the Python version, you may encounter some common issues. Here are some troubleshooting tips to help you overcome them:

Python not Recognized: 

If the command python –version returns an error indicating that Python is not recognized, check if Python is installed correctly and added to the system’s PATH environment variable.

Multiple Python Versions Installed 

If you have multiple Python versions installed, you may need to specify the version you want to check. For example, if you have both Python 3.8 and Python 3.9 installed, you can check the version of Python 3.9 using the command python3.9 –version.

Python version not displayed: If the command python –version does not display the version information, try using the python -V command instead. This will display the version information in a more verbose format.

Best Practices for Managing Multiple Python Versions

If you work with multiple Python projects or environments, you may need to manage multiple Python versions on your system. Here are some best practices to help you manage multiple Python versions:

Use Virtual Environments: 

Virtual environments allow you to create isolated Python environments for each project, which helps to avoid version conflicts and ensures that each project uses the correct Python version.

Use Version Managers: 

Version managers like pyenv or conda allow you to easily install and manage multiple Python versions on your system.

Keep your Python Versions Up-to-Date: 

Regularly update your Python versions to ensure you have the latest security patches and features.

Conclusion

In this article, we’ve explored multiple methods to check the Python version on both Linux and Windows operating systems. We’ve also discussed the importance of knowing the Python version, common issues you may encounter, and best practices for managing multiple Python versions.

By following the methods outlined in this article, you can easily check the Python version on your system and ensure that you’re using the correct version for your projects. Remember to keep your Python versions up-to-date and use virtual environments or version managers to manage multiple Python versions.

As Python evolves, keep yourself informed about new releases, features, best practices, and industry trends. With up-to-date installation research choose a trusted platform that aligns with your technical needs. With Ultahost’s Windows hosting, you can easily upgrade your resources as your needs grow with a few clicks.

FAQs

How do I check the Python version in Linux?

You can check the Python version in Linux by opening a terminal and typing python –version or python -V. Alternatively, you can also use python3 –version or python3 -V depending on your Python installation.

How can I determine the Python version in Windows?

In Windows, you can check the Python version by opening a command prompt and typing python –version or python -V. Similarly, you can use python3 –version or python3 -V if you have multiple Python installations.

Is there a command to display more detailed information about the Python installation?

Yes, you can use python -V (or python3 -V) to get the Python version, and python -VV (or python3 -VV) to display more detailed version information, including the Python compiler information and the build date.

What’s the difference between python and python3 commands?

The python command typically refers to the default Python 2.x installation on many systems, while python3 refers to Python 3.x. It’s recommended to use python3 for Python 3.x code, as Python 2.x is no longer supported.

How can I verify if Python is installed on my system?

You can check if Python is installed by running python –version or python -V in the terminal (or command prompt). If Python is installed, it will display the version number; otherwise, it will prompt an error indicating that the command is not recognized.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как установить windows на материнке msi
  • Nv container class windows
  • Как посмотреть последние скачанные файлы на компьютере windows 10
  • Windows 10 домашняя базовая для одного языка
  • Chinese simplified windows 10