Python Forum
pip install requests doesnt work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pip install requests doesnt work
#1
Hello guys,
I am total newbie in python and I want to try it.

So first I run Terminal (or at least I think this is terminal) > python.exe
Then I use pip install requests and that's it :D I've receive this error>

File "<stdin>", line 1
pip install requests
^^^^^^^
SyntaxError: invalid syntax

and the question is why? Where is the catch?
Reply
#2
pip is run from the command line, not the Python interpreter. It is a program that installs modules, so you can use them from Python. So you have to run the command line. If you are using windows open the menu and type CMD, on mac click the Launchpad icon in the Dock - type Terminal in the search field, then click Terminal , on linux directly pressing [ctrl+alt+T]
Reply
#3
VadimCr - thanks for help!

but when I run cmd and write in there pip install requests it comes like this "'pip' is not recognized as an internal or external command,
operable program or batch file."

and of course, I forgot to write I am using windows :)
Reply
#4
Check this link on how to install pip.
misodca likes this post
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#5
Seems like you haven't installed Python the right way, and you haven't defined the path for your pip! There are a couple of methods to fix this issue, all of them are described here https://www.stechies.com/pip-not-recogni...l-command/
You can reinstall Python but do not forget to click Add Python 3.9 to the PATH
misodca likes this post

Attached Files

Thumbnail(s)
   
Reply
#6
yes VadimCr! That was it! Thank you! :)

(I have to say because of your post - about cmd - I've tried install python on second PC where exactly I check that button .. and voala :D anyway, thank you veru much! now I can study again)
VadimCr likes this post
Reply
#7
Also our own tutorial https://python-forum.io/thread-3258.html
misodca likes this post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#8
(Apr-20-2022, 08:07 AM)misodca Wrote: yes VadimCr! That was it! Thank you! :)

(I have to say because of your post - about cmd - I've tried install python on second PC where exactly I check that button .. and voala :D anyway, thank you veru much! now I can study again)

Happy I was able to help you! Good luck on studying
Reply
#9
Photo 
The error you're encountering is because you're trying to run the pip install requests command directly within the Python interpreter (Python REPL). However, pip commands are meant to be executed in the terminal or command prompt, not within the Python interpreter.

To install packages using pip, you need to open a terminal or command prompt window first, and then run the pip install requests command there.

Here are the steps you can follow:
  1. Open a terminal or command prompt window (not the Python interpreter).
  2. Type python and press Enter to start the Python interpreter. You should see the Python prompt >>>.
  3. At the Python prompt, you can now import the requests module and use it in your code.
    import requests
    # Use the requests module here
  4. When you want to install the requests module (or any other package), exit the Python interpreter by typing exit() and pressing Enter.
  5. Now, in the terminal or command prompt window, run pip install requests to install the package.
  6. After the installation is complete, you can start the Python interpreter again and import the requests module without any errors.
Remember to run pip install requests in the terminal or command prompt window, not within the Python interpreter.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  print doesnt work in a function ony 2 288 Mar-11-2024, 12:42 PM
Last Post: Pedroski55
  Pydoc documentation doesnt work Cosmosso 5 4,351 Nov-25-2023, 11:17 PM
Last Post: vidito
  Ldap3 Python print(conn.entries) doesnt work ilknurg 15 5,706 Dec-28-2022, 11:22 AM
Last Post: shad
  pip install pystyle doesnt work person_probably 2 2,092 Sep-23-2022, 02:59 PM
Last Post: person_probably
  Why doesnt chunk generation work? LotosProgramer 1 1,939 Apr-02-2022, 08:25 AM
Last Post: deanhystad
  if conditions in the for indentation doesnt work ? Sutsro 6 3,902 Jun-15-2021, 11:45 PM
Last Post: bowlofred
  I have two Same Code but One of them Doesnt Work beginner721 6 3,071 Jan-22-2021, 10:56 PM
Last Post: beginner721
  code doesnt return anything ofrihemo 3 2,025 Jun-30-2020, 05:14 PM
Last Post: ofrihemo
  BEGINNER: My calculator doesnt work iskov 5 3,169 Oct-09-2019, 07:45 AM
Last Post: buran
  Python: command “python -m pip install --upgrade pip” doesn't work apollo 2 13,246 Sep-16-2019, 03:11 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020