When I run import requests
I receive an error: ImportError: No module named requests
. I have looked at other responses to similar questions and tried nearly everything and nothing is working. I'm using MacOS and my project is on my desktop in a folder with a single file with the one line of code I wrote above. When I run pip3 list, the request package is installed.
I understand you, python can be a mess. Macos has a default installation of python version 2.XX when you type 'python' in terminal it executes the preinstalled python v2
Now since you are using pip3 I assume you've installed latest python 3.XX and pip3 will install modules for python 3 only not for the default python 2
So when you are running your script.py, insted of python script.py
try python3 script.py
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.