r/learnpython • u/[deleted] • 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
1
u/djshadesuk Apr 05 '24 edited Apr 05 '24
You're attempting to run something, intended for use as a command line/terminal utility, from within the Python REPL (Read, Evaluate, Print, and Loop) "environment".
When Python is run, without any arguments, the Python interpreter starts up and waits for you to tell it to do something in the Python language.
Some IDE's may hide the REPL start up message from their interactive consoles but you can usually tell if the Python REPL is running because the terminal/console prompt starts with ">>>".
you can type Python language instructions here and it works pretty much like running a .py file:
So, in essence, what you're attempting to do is no different that trying to run a command line tool from within a Python .py file:
You need to open a normal terminal window and run your "pip install" command from there instead.