Python Forum

Full Version: How to find out from outside Python (in Windows) the current version of Python?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Assume I installed in the past Python on my Windows 10 system.

Is there a way to find out from OUTSIDE Python the currently installed version of Python?

This should be done with a one-line command from command line e.g. in CommandPrompt or in Powershell.

Thank you
in cmd prompt python --version or python3 --version
Also py.exe will find(or run) all version installed.
py has been there sine the early Python 3 releases.
Use py --list or for help py --help
# Only py will use last version installed 
G:\div_code
λ py --version
Python 3.12.0

# Run code
G:\div_code
λ py hello.py
C:\Python312\python.exe
hello world

# Use Python 3.9
G:\div_code
λ py -3.9 hello.py
C:\Python39\python.exe
hello world

# Install to eg only 3.9 
G:\div_code
λ py -3.9 -m pip install requests
Requirement already satisfied: requests in c:\python39\lib\site-packages (2.26.0)

# Use Python 2.7
G:\div_code
λ py -2.7 hello.py
C:\Python27\python.exe
hello world
py.exe

is NOT part of the Windows Python v3.12.0 installation.
So your suggestion is useless for me
(Oct-04-2023, 03:44 AM)pstein Wrote: [ -> ]py.exe

is NOT part of the Windows Python v3.12.0 installation.
So your suggestion is useless for me
It dos install,but not in Python folder.
Before it did install to C:\Windows,now it install to C:\Users\<Pc User>\AppData\Local\Programs\Python\Launcher\py.exe
The reason for this is OS environment path,so it always available.
[Image: PY3xI5.png]

C:\code
λ py --version
Python 3.12.0

C:\code
λ py -3.10 --version
Python 3.10.4

C:\code
λ where py
C:\Users\Tom\AppData\Local\Programs\Python\Launcher\py.exe
Link Removed yes, you can check the version of Python currently installed on your Windows 10 system from the command line using Command Prompt or PowerShell