Uncategorized

Python –version command isn’t working on windows – Python Help



giving the command

python --version

gives the following error

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

I think when I first installed python 5 or 6 years ago, I didn’t install it with path, so that’s where the problem started.
I have tried reinstalling (with path this time) and repairing, but it doesn’t work.
How can I fix this?

This is because of changes Microsoft introduced with a Windows 10 update. They’re supposed to make it easier for new students to get Python, but it’s been counterproductive in practice IMO.

Please see:

Try using the py command instead. Docs ref 4. Using Python on Windows — Python 3.12.1 documentation

I also find the py -0 command useful to list all the installed python versions.

Microsoft Windows [Version 10.0.19045.3803]
(c) Microsoft Corporation. All rights reserved.

C:\Users\barry>py --version
Python 3.12.1

C:\Users\barry>py -0
 -V:3.13          Python 3.13 (64-bit)
 -V:3.13-32       Python 3.13 (32-bit)
 -V:3.12 *        Python 3.12 (64-bit)
 -V:3.12-32       Python 3.12 (32-bit)
 -V:3.11          Python 3.11 (64-bit)
 -V:3.11-32       Python 3.11 (32-bit)
 -V:3.10          Python 3.10 (64-bit)
 -V:3.10-32       Python 3.10 (32-bit)
 -V:3.9           Python 3.9 (64-bit)
 -V:3.9-32        Python 3.9 (32-bit)
 -V:3.8           Python 3.8 (64-bit)
 -V:3.8-32        Python 3.8 (32-bit)
 -V:3.7           Python 3.7 (64-bit)
 -V:3.7-32        Python 3.7 (32-bit)
 -V:3.6           Python 3.6 (64-bit)
 -V:3.6-32        Python 3.6 (32-bit)
 -V:3.5           Python 3.5
 -V:3.5-32        Python 3.5-32
 -V:3.4           Python 3.4
 -V:3.4-32        Python 3.4-32
 -V:2.7           Python 2.7
 -V:2.7-32        Python 2.7-32

I’ve been meaning to ask (although only out of curiousity, since I’m on Linux now): Does py know about other Python installations besides the ones created by an official python dot org installer? If so, how?

I think PEP 514 is the answer you are looking for.



1 Like



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *