Check python version To get version of the current Python running in your system, we can use sys module. 12 is installed? Answer fails to succinctly print the version (and related metadata) of the active Python interpreter with a terse one-liner like from sys import version; version. 1150. See the different commands, attributes, and methods to access the version number and other details of your interpreter. version, see examples of output, and understand why it’s important for both beginners and experienced developers. 5’ signifies that Python version 3. 9 --version # Check Python 3. Method 2: Command Line for Python 2. These flags are part of Python’s in-built module and they return the version of the python Jan 31, 2025 · How to Check Python Version 1. One way to check the Python version from a script is by using the sys Mar 9, 2024 · To check your Python 3 version, type python3 -V; To check your Python version, run python ‐V in your command line (Windows), shell (Mac), or terminal (Linux/Ubuntu). We will touch on both of the methods below. 6. you can also run whereis python to see how many versions are installed. . The command will print the default Python version, in this case, that is 3. 4), asking uv python to check if this version exists on the system. For Python 3: python3 --version or python -V. Utilisez cette commande pour afficher la version de Python ; python3 --version. Mar 28, 2022 · Learn how to check your Python version using the command line and within a Python script on Windows, macOS, and Linux. Is Python pre-installed on Windows 11? Some versions might come with Python pre-installed, but it’s not guaranteed. Using the pkg_resources module 5. Conclusion. Linux is a popular operating system among developers. If you're checking the version in an if statement like the OP is, Chris' answer makes much more sense, as you don't have to go through the clunky process of searching the string for the desired info. Utilisez le raccourci Ctrl Alt T pour ouvrir la ligne de commande sur votre machine basée sur Linux. Feb 20, 2024 · Method 1: Using python --version or python -V. For Windows, macOS, and Linux: Open your terminal or command prompt. To do so, include the following code in your Python script: There are several ways to check the Python version on a Windows machine. python_version to Check Python Version Oct 7, 2022 · Check the Python Version inside a Script. Another way to check the Python version is to use the platform module, which provides a way to retrieve information about the underlying platform. Dec 17, 2024 · The search functionality allows developers to verify the existence of a Python version without manually checking through installed versions, saving time and effort. Aug 28, 2023 · If you’re using these keywords in your script, you need to ensure that you’re running a compatible Python version. Mar 19, 2024 · Artículo original: Check Python Version – How to Check Py in Mac, Windows, and Linux Python es un lenguaje versátil y ampliamente conocido por su simplicidad y legibilidad. 5 (default, Jan 27 2021, 15:41:15) The output ‘3. So let’s get started. Check Python version: python -V or python --version or apt-cache policy python. For doing this just open cmd and type python. The quickest way to check the Python version on a system is via the command line or terminal. May 3, 2018 · The following script will check python version and print the version number to the standard output. The simplest way is to open a command prompt and type the following command: python --version. Jan 8, 2022 · Check the Python version with sys module It is useful for checking which version of Python is running in an environment where multiple versions of Python are installed. Ou . To check the version of Python installed on your system from the shell, follow these steps. On Windows, you have to download and install it. Using the sys Module. Python Version. Nov 5, 2024 · Knowing your Python version is key to writing compatible, robust code. However, if you still use Python 2 for some applications, omit 3 from the command to check which Python 2 version you have installed. Follow the following steps to check the Python version on Window 10: Step 1: Open the command prompt by pressing win +r shortcut key and type cmd to open the command prompt. This simple command works on all operating systems, including Windows, Linux, and MacOS. We will check the Python version in Windows, macOS, and Linux. Here are the steps for each operating system: To find Python via Command Prompt, open cmd and type python --version or python. Oct 6, 2023 · Learn how to find out the major, minor, and micro versions of Python on your computer using simple commands. 2. The Python version will be listed. Windows 10 users will need to use Windows PowerShell to check the Python version. py The output will provide detailed information about the Python version components. Step 2) This opens the below window as shown below: Aug 30, 2018 · FYI this works, but the python_version function returns a string (e. Python - for문에서 리스트 순회 중 요소 값 제거; Python - 두 리스트에서 공통 요소 값 찾기; Python - 문자열 앞(뒤)에 0으로 채우기; Python - 공백으로 문자열 분리; Python - 중첩 리스트 평탄화(1차원 리스트 변환) Python - 16진수 문자열을 Int로 변환; Python - 두 날짜, 시간 비교 Apr 22, 2025 · Python is a widely used high-level programming language, and different versions of Python can have significant differences in syntax, libraries, and features. Apr 22, 2025 · Jupyter Notebook is a popular interactive computing environment widely used in data science, machine learning, and various Python - related development tasks. version_info는 버전 정보가 Tuple입니다. 1013 usage: py [launcher-args] [python-args] script [script-args] Launcher arguments: -2 : Launch the latest Python 2. 7. The sys module contains the Python version and additional information, such as the build and compiler. on my system it prints '3. Open A Terminal, Command Prompt, or Power Shell. Naturally, 240 upvotes ensue. g. This is the most straightforward method to check the Python version. x […] Jul 7, 2023 · By following these steps, you will be able to check the Python version installed on your Mac using the Terminal application. The Python version will display in the Jan 2, 2025 · Vérifier la version de Python sous Linux. version to find detailed version information in your code. 5 or Python 2. Find out all you need to know about getting your Python version in this guide. This blog post will guide you through various ways to check your Python version Jan 24, 2024 · Checking the Python version can be done using the command line or terminal on Linux, Mac, and Windows. Using the python3 command-line tool 7. It’s always best to check. This will display the version of Python installed on your system. python_version_tuple. All you need is to open the terminal then type python -V in the prompt. 10 --version # Check Python 3. Check Python version. python_version() print (python_version) Once ready run the check-python-version. 10. import sys module and read the sys. Run the python or python3 command with the --version or -V option in the Command Prompt (cmd) on Windows or the Terminal on macOS and Linux. This method is pretty much the same as using a command prompt, however, in this method, we will be using Shell instead of the command prompt to check the version of Python installed. py and run it in the Command Prompt: python detailed_version_check. May 21, 2025 · This lists all installed Python versions. Using the Command Line or Terminal. How to Check Python Version Using The Sys Module. To find out which version of Python is installed on your system, run the python3 --version or python3 -V command: python3 --version. py: import platform python_version=platform. 18 Check Python 3 Version python3 C:\Users\admin>py -h Python Launcher for Windows Version 3. Debido a su naturaleza de constante evolución, nuevas versiones de este lenguaje están siendo desarrolladas y entregadas frecuentemente, cada una ofreciendo nuevas Mar 28, 2022 · To check the version that your Python interpreter is running we can use a version command on the python command. This wikiHow article will show you easy ways to see which version of Python is installed on Windows, Mac, and Linux. Oct 30, 2022 · Check Python Version: Command-Line. If not found, ensure Python is installed and PATH is correctly set during installation. This can help with compatibility and debugging. Using the subprocess module to check the Python version 4. Type python –version. Assuming you have Python installed, and the terminal open, you can check your current Python version with the following command: $ python --version Python Dec 15, 2023 · Since most Linux versions now use Python 3 by default, we use python3 in the command syntax. Aug 12, 2024 · How to check the Python version on Mac? Here are steps to check the Python version: Step 1) To check the Python version in Mac OS. Save the below python code as a new file named check-python-version. Once the Terminal is open, type the following command to check your Python version: python --version Alternatively, if you have Python 3 installed, use the following command to check the Python 3 Apr 18, 2025 · Different Ways to Check Python Version with Full Code 1. 8 can (surely will) give a different version of a library than opening with Python 3. The Python version in Windows operating systems can be checked using the command 'python --version. x version -X. Mar 18, 2024 · Checking Python Version # Python is pre-installed on most Linux distributions and macOS. 5 or later, simply enter the following command in your command prompt or terminal: Nov 15, 2023 · The easiest and most direct way to check your Python version on Linux is by using the python command line tool. The organization also announced that every Python version would receive bug-fix updates for a year and a half and security updates for three and a half years before bringing the version to its end-of-life at the end of the five years. 5 days ago · Understanding which Python version you’re working with is crucial when developing in Jupyter Notebook. To check what version the python command points to, you can run: Jan 12, 2024 · If Python is installed, the version number will be displayed. But passing the --version flag will make it instead print out the installed version and exit: Check Python 2 Version python2 --version. 🐍 Method 2: Using pyenv Step 1: Install pyenv. Checking the Python version that is installed is important for maintaining compatibility, ensuring optimal performance, and addressing potential issues in your May 30, 2024 · 2. Both --version and -V flags display the version of Python that executes when you type ‘python’ in your command prompt or terminal. Thankfully, there is a quick command, and even some Python script, to check your currently installed Python version. Checking Python Version in Linux. Once . To begin, you need to check the current version of Python installed on your system. python_version and platform. To check your Python version in your script, run import sys to get the module and use sys. Check Python Version Using the Command Line Apr 23, 2025 · Check the Python version on the command line: --version, -V, -VV. May 28, 2025 · Checking the Current Python Version. To check Python version in Linux, you can use python -V command. x version -3 : Launch the latest Python 3. version property. Aug 15, 2022 · Knowing your Python version can make the difference between an application running or frustratingly failing. How to check if Python 3. i) Windows: In Windows operating systems, we can use the command python --version to check the python version. To check the Python3 version, type python3 –version. Why Check Python Version? Here are 5 key reasons you need to verify Python version: Avoid breaking changes between versions – Major Python releases like 3. Open your terminal and use this simple check Python version command: For Python 2: python --version or python -V. Using the platform module 2. Using platform. For example, opening the terminal with Python 3. 10 py -2 --version # Check latest Python 2. Alternatively, you can use the Windows Search function to check for the presence of Python version latest. Using sysconfig module and os. There are a couple of different methods that you can use to check the version of Python from within a Python script. Apr 12, 2024 · Step 5: Check the Python version. La plupart des systèmes d’exploitation Linux modernes ont Python préinstallé. How to check Python version using the sys Module; How to check Python version using the platform Module; This will help you ensure your script runs on the desired version and adapt its behavior based on the version being used. Also, see how to deal with multiple Python versions installed on your system. How To Check Python Version with a Python Script. 파이썬 스크립트 안에서 버전 확인 (2) sys. Mar 18, 2025 · Save this code as detailed_version_check. 10; If you have multiple Python versions installed, you can use the appropriate command like python2 --version or python3 --version to check the specific version. Find out the difference between Python 2 and Python 3 and why you should choose Python 3 for new applications. The platform module has two functions that can be used to check the Python version: platform. It’s easy to check the Python version, so let’s do that. join 8. Note 1: We must regard the Python version. Q: Can I check the Python version from a script? A: Yes, you can check the Python version from within a script. Explanation: The command utilizes find followed by a specific version number (e. What if “python –version” doesn’t work? Try using “python3 –version” or check if the system PATH variable is set Mar 2, 2025 · If you have both Python 2 and Python 3 installed, you can check their versions using the commands python3 --version and python2 --version. py script to obtain python version. $ Nov 19, 2020 · Learn how to check your Python version on the command line and in the script on Windows, macOS, and Linux systems. In this article, you’ll learn about using sys. version` attribute and the `python --version` command. Y : Launch the specified Python version The above all default to 64 bit if a matching 64 bit python is present. Method 1: Using the Command Prompt. For systems running Python 2. 5 and Above. Nov 1, 2024 · The Python sys. If we have installed different versions of Python, we have to open the terminal in the Python version we are interested in. python3 –version This command will display the current version of Python installed on your system. May 20, 2014 · To check the version of one's Python's Software version, one should use the following code in command prompt: python -V Reference: Feb 7, 2016 · Yes, this happens. Using the sys module 3. Step 2: Execute Command python –version and hit enter. Whether you’re debugging compatibility issues, ensuring consistency across environments, or simply trying to confirm if a new feature is available, knowing how to check the Python version can save time and frustration. Check Python Version from Shell. path. The Python Launcher is automatically installed with Python 3. Open a terminal, command prompt, or Power Shell. It can help you ensure compatibility with libraries, understand the capabilities and limitations of the Python environment, and avoid potential errors that Jan 15, 2024 · How to Check Python Version in 3 Easy Steps. Step 2: Check Python Setup . 9 py -3. major 처럼 세부 버전 정보에 접근할 수 있습니다. Checking the Python version in CMD is a simple yet essential task for Python developers. 8. python --version Jan 21, 2025 · Check the Python Version: Similar to Windows, you can use python --version in the Terminal. Another way to check the version is to open the Python interpreter by typing python in the command prompt. 3+ on Windows and provides a consistent way to manage multiple Python versions. It’s particularly Nov 28, 2024 · To check Python 2, run: python --version To check Python 3, run: python3 --version If both versions are installed, you'll see their respective versions displayed. Our guide covers the different ways to check, including using the built-in `sys. To avoid problems and fix possible incompatibilities, incorporate a system in your application’s code that verifies the Python version just before running. Now check whether Python is already set up in Command Prompt or not. To launch Windows PowerShell, go to the Start Menu and type powershell Aug 17, 2023 · To check the Python version in macOS, open the Terminal by going to Finder, clicking on Applications, and then navigating to Utilities > Terminal. Jun 15, 2021 · Learn different ways to find out your python version in command line, such as python -c "import sys; print(sys. Open the Terminal by typing the terminal command in the search box in the top right corner of the Mac OS desktop menu and click on it. 5 is being used. In this extensive 2800+ word guide, you‘ll learn numerous methods to check Python version on any operating system. In 2019, The Python Software Foundation announced a change in the release calendar, making it so a new version of the language is released every 12 months. Jul 15, 2024 · On Windows, if you installed Python 3 from the official installer and checked the option to add Python to PATH, the python command will typically refer to Python 3. If you see any Python version then it is already setup. Because accessing the command line prompt or terminal varies from system to system, this part of the tutorial is split across the different operating systems available to you. Type one of the following commands and press Enter: python –version; python -V; If the above command doesn’t Jan 31, 2025 · Yes, but you may need to manage them using a version manager like pyenv. Here’s how you can check your Python version within a script: import sys print(sys. How to Check Python Version in Windows. Depending on the machine you are using (Mac, Linux, Windows), you will open up a terminal, command prompt, or Power Shell. Dec 5, 2024 · This will display the complete version information, including minor details about the build. The steps to check the python version in Windows are very simple: How to Check Python Version in MacOS; How to Check Python Version in Linux; How to Check Python Version in Windows, Mac & Linux Posted in Python by Dirk - last update: Jan 10, 2024. To check a specific version: py -3. The sys. version attribute is an essential tool for checking the version of Python you’re running. i) Windows. Take note of the version number, as you’ll need it later. This command launches the Python interpreter. Knowing the Python version you are working with in a Jupyter Notebook is crucial. Mar 25, 2025 · Check Python Version: Command-Line. 1'). That’s it for method 1. version)" or py --version. x. Share. Install pyenv using the following May 31, 2025 · Note: If Python is not installed on your computer, then it can be installed with How to Install Python on Windows . Even though we thought Python3 was running, there was a case where Python2 was running, so if something goes wrong, check it once. Apr 22, 2025 · Check the Python Version Using the Command Line. See answers from python experts and users with various scenarios and solutions. Knowing which version of Python you are using is crucial, especially when you are working on projects that might be affected by version compatibility issues. python --version. Aug 24, 2023 · If you’ve installed Python 3 alongside the system Python, the command is usually python3 and you can check the exact version using: python3 --version 2 – Check Python version on Windows 10. , 3. 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. In this article, we will focus on understanding how to check the Python-version in CMD on different systems. version) # Output: # 3. Open the shell on your system. The command line provides a straightforward way to get the Python version. If Python is installed and added to the system PATH, this will return the version or launch the interpreter. Nov 4, 2020 · Learn how to quickly and easily check your Python version in just a few steps. Make sure to use Oct 22, 2022 · python_version())” Check Python version in Linux with python -V command. May 17, 2025 · That’s a tip to remember, so you’re never confused about which command will check Python version. version property returns a string value with the version, and addition information like build version, and compiler used. Open your terminal and type: python –version or. bash yourusername@yourcomputer:~$ python --version Python 3. If you install Python in Ubuntu Linux, To check the Python version in Linux, you can use the following command: Feb 11, 2025 · In Windows 10, you can check your Python version using the Command Prompt. Using the __version__ attribute to check the Python version 6. Let us first learn how to check the python version using the various command-line commands used in different operating systems. version_info. Output: Python 2. uzdxd vtpykdv zyqbv wjuqtf kciwl hhnmxdz noevoy yqksbco dcbbh xec