Reputation: 732
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
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
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).
Install pip
for Python 3 – using one of the following methods:
easy_install
(may be available as easy_install-3.5
),python -m ensurepip
(thanks, Mark Dickinson)Use pip
to install the requests
module:
pip3 install requests
Upvotes: 14
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