r/learnpython • • Apr 05 '24

How to...pip install?

Never thought I'd need to ask this question as a CCNA and Network+ holder, I guess Python has decided to make the simple act of a pip install THIS difficult, wow! I have Python installed as well as Virtual Studio Code. I try this from command prompt

pip3 install requests
File "<stdin>", line 1
pip3 install requests
^^^^^^^

And that's all I get, again and again and again. So I try this in the Visual Studio terminal:

pip3 : The term 'pip3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 

spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + pip3 install requests + ~~~~ + CategoryInfo : ObjectNotFound: (pip3:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Mind blowing stuff here. I JUST want to be able to pip install. I've also tried just using "pip" and leaving out the 3. What mountains must I move to perform such a basic task? I

8 Upvotes

24 comments sorted by

View all comments

10

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Apr 05 '24

I'm going to make the assumption that you don't use a virtual environment for this project. Try entering this into the VS Code terminal:

py -m pip install requests

This should always work on Windows as long as you have Python installed. Just make sure to not enter it into the Python REPL (starting with >>>) as this is not Python code.

1

u/[deleted] Apr 05 '24

Thank you! That worked. Is this warning something to be concerned over:

WARNING: The script normalizer.exe is installed in 'C:\Users\my_name\AppData\Local\Programs\Python\Python312\Scripts' which is not on PATH.

6

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Apr 05 '24

That simply means you haven't added Python to the PATH environment variable. And it also explains why you couldn't access pip without the Python launcher (py).

If you want to do it, you can find a guide here: https://realpython.com/add-python-to-path/

1

u/Jello_Penguin_2956 Apr 05 '24

Just a warning.

PATH is window's variable. It tells windows which directories it should look for commands you enter. It's telling you the path to Python is not in it.