Steve
Steve

Reputation: 732

No module named 'requests' Python 3.5.0

I need to use requests in my code but it says that it's not installed. I get the following error: No module named 'requests'. It's actually installed and works in python 2.7: Requirement already satisfied (use --upgrade to upgrade): requests in /Library/Python/2.7/site-packages. I searched a lot and tried to reinstall it, to download missing libraries, and etc... but nothing helped. How can I make it work on python 3.5 ?

Upvotes: 7

Views: 35363

Answers (3)

UnknownEncoder
UnknownEncoder

Reputation: 113

The fastest and shortest answer would just be to do

pip install requests

And if you encounter a error try doing

sudo pip install requests

More info on this module can be found here https://pypi.org/project/requests/

Upvotes: 0

Anthony Geoghegan
Anthony Geoghegan

Reputation: 11983

Python 2 and 3 (and their packages) can be installed and co-exist independently of one another. I would suggest using pip as the best way to install Python packages (and keep them up-to-date).

  1. Install pip for Python 3 – using one of the following methods:

    • easy_install (may be available as easy_install-3.5),
    • the distribution package manager (if running GNU/Linux) or
    • python -m ensurepip (thanks, Mark Dickinson)
  2. Use pip to install the requests module:

    pip3 install requests
    

Upvotes: 14

juliusmh
juliusmh

Reputation: 467

You can even place the "requests" Folder (https://github.com/kennethreitz/requests/tree/master/requests) next to your "script.py" and import requests from any script within the folder containing the requests folder
> root --> requests ----> init.py ----> [more] --> script.py

script.py can now import requests as always

Upvotes: 0

Related Questions