Python Forum
How to find out from outside Python (in Windows) the current version of Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find out from outside Python (in Windows) the current version of Python?
#1
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
Reply
#2
in cmd prompt python --version or python3 --version
pstein likes this post
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply
#3
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
Reply
#4
py.exe

is NOT part of the Windows Python v3.12.0 installation.
So your suggestion is useless for me
Reply
#5
(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
Reply
#6
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
Gribouillis write Jun-28-2024, 08:47 AM:
Clickbait link removed. Please read What to NOT include in a post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  MariaDB Connector/Python; version mismatch shopgeek 1 475 Feb-24-2025, 05:06 AM
Last Post: from1991
  I'm trying to install python 3.11.11 on windows 10 - it doesn't work Petonique 2 1,582 Feb-04-2025, 05:42 PM
Last Post: snippsat
  Building specific Python version on Raspberry PI 5 (Raspbian) andrewk 2 653 Feb-03-2025, 11:41 AM
Last Post: iterate
  Python 3.13(Windows) does not have the latest module OS phillip_from_oz 1 802 Dec-13-2024, 04:35 AM
Last Post: deanhystad
  How to re-register .py file extension to new moved Python dir (on Windows)? pstein 5 1,246 Nov-06-2024, 03:06 PM
Last Post: DeaD_EyE
  Trouble Setting Up Selenium with FireFox (Python 3 on Windows 10)) gw1500se 5 5,615 Oct-07-2024, 06:41 PM
Last Post: AlluminumFoil
  where to find current app documentation standards and tools radlyeel 2 708 Sep-28-2024, 04:21 PM
Last Post: Gribouillis
  how to find difference between fake driving license or real using python? pjaymn 5 4,915 Jun-14-2024, 07:01 AM
Last Post: Pedroski55
  run part of a script with a different version of Python jdog 3 2,242 May-27-2024, 01:57 AM
Last Post: Alice12
Question How to add Python folder in Windows Registry ? Touktouk 1 1,189 Feb-20-2024, 01:04 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020