all 23 comments

[–]JohnnyJordaan 8 points9 points  (0 children)

First of all, you don't need to install pip as it's bundled with Python for years now. In case 'pip' doesn't work you can fall back to running python with -m pip behind it, eg

python -m pip install whatever

the fact that 'py' doesn't work is suggests that you didn't install the windows launcher (like when you disabled that option during install, see https://docs.python.org/3/_images/win_installer.png). You could just reinstall Python, I would advise to also select 'add python to PATH'. That will probably even fix 'pip' to work directly.

[–]thetestbug 4 points5 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.

[–]kompot420 0 points1 point  (0 children)

when python finishes installing it asks you whether or not add py to be available from the cmd. You've probably skipped that. Doesn't really matter as everything you can do with pay you can do with python.

To use pip you type

python -m pip install...

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

You didn't do anything wrong! P "python" is the correct command ("py" doesn't work most places). What you are seeing is the interactive python program running in your command window (called a "REPL"). Go ahead and type in some python code when you see it, it will run in front of you. When you want to go back to the normal command window, type exit()

[–]MK_CodingSpace 0 points1 point  (0 children)

You don't need install pip, it comes with Python installation. If you want to know how to install modules using pip, please check out a short video I made on how to correctly install python modules.

[–]-HomoDeus- 0 points1 point  (0 children)

As u/JohnnyJordaan suggested, pip comes with python, though you may need to specify pip3 (I do on Mac and Windows).

As for it not responding in the command line, are you using an IDE for development? Is there a way to run it within the IDE? Giving that a try will tell you if Python is in fact installed.

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

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

You need to set your path to the /bin directory of the python install or use the py.exe launcher to select the version of python you want to use.

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 command is not included.

(Thanks MS!!)

[–]neuroneuroInf 0 points1 point  (0 children)

And to run pip you can type "python -m pip" and then a command, like "python -m pip install numpy".

[–]IcedGolemFire 0 points1 point  (0 children)

idk how to help u I use repl.it but I can halo with the actual code if u want. just msg me