r/pythonhelp • • Oct 25 '22

installing module proble.

Hi, this is so basic I feel foolish but I can't figure it out. I'm very new to python and I'm trying to install requests. I've tried both

python -m pip install requests

And

pip install requests

And

pip3 install requests

All give me an invalid syntax error and I am baffled.

Thanks!

3 Upvotes

4 comments sorted by

1

u/Goobyalus Oct 25 '22

Are you inside a Python shell instead of an OS shell?

2

u/DrMonkeyLady Oct 25 '22

I was- thank you!

1

u/Goobyalus Oct 25 '22

Make sure you're using the Python that you expect (e.g. python --version or python3 --version or whatever), and use that python with -m pip install requests so that it's installed for the correct version of Python.

If you have multiple versions of Python, it could be ambiguous which version the pip command applies to.

1

u/deleriumtriggr Oct 25 '22 edited Oct 25 '22

Edit: Well you can read on further but i was too slow to respond. Lol.

Fun fact: I sold my first program that used requests, beautifulsoup, and xlsxwriter. Was a webscraper that wrote spreadsheets for a business that bought/sold secondhand items. It found recently sold data for phones and electronics - did about 130 different items in a couple minutes. Real world scenario of value of what you're starting on.


The following can be ignored. 😉

You need to not type in python in the first line.

By typing python you're telling your computer to first start python. (Given "add to PATH" was checked during installation).

Pip is not a python extension. It is it's own installer.

I assume trying to continue made it so you were within the python shell, throwing errors because python doesn't understand "Pip install requests"

Pip install is meant for command line. Try "pip install request" or "py pip install requests" if that doesn't work, lemme know what it says and I'll troubleshoot it for u