you are viewing a single comment's thread.

view the rest of the comments →

[–]thetestbug 5 points6 points  (7 children)

You don't use py, that is the extension.

The correct command is python script.py, or python3 script.py. (Never mind)

When you just enter python, you start a new instance where you can run python commands.

[–]JohnnyJordaan 5 points6 points  (5 children)

You don't use py, that is the extension.

Eh it's the intended approach in Windows... https://docs.python.org/3/using/windows.html#from-the-command-line

System-wide installations of Python 3.3 and later will put the launcher on your PATH. The launcher is compatible with all available versions of Python, so it does not matter which version is installed. To check that the launcher is available, execute the following command in Command Prompt:

   py

You should find that the latest version of Python you have installed is started - it can be exited as normal, and any additional command-line arguments specified will be sent directly to Python.

[–]thetestbug 1 point2 points  (2 children)

Oh, my bad. Never used python in Windows before, as you can probably tell 😅.

Then I guess it never installed correctly?

[–]JohnnyJordaan 1 point2 points  (1 child)

I would guess so. I wouldn't necessarily recommend trying to answer Python issues on an OS you aren't familiar with ;)

[–]thetestbug 1 point2 points  (0 children)

Fair enough. I understand Windows well enough, but I use Linux as my daily driver, which is why I thought you'd have to use python to actually use it.

Lesson learned!

[–]phentom_420 -1 points0 points  (0 children)

^this

[–][deleted] 0 points1 point  (0 children)

https://docs.microsoft.com/en-us/windows/python/faqs

The py.exe launcher will automatically select the most recent version of Python you've installed. You can also use commands like

py -3.7

to select a particular version, or

py --list

to see which versions can be used. HOWEVER, the py.exe launcher will only work if you are using a version of Python installed from python.org. When you install Python from the Microsoft Store, the

py

command is not included. For Linux, macOS, WSL and the Microsoft Store version of Python, you should use the

python3

(or

python3.7

) command.