0

I am trying to import a module that I know for a fact that was installed, but I am getting the ModuleNotFoundError: No module named '' error. How can I solve this problem ?

HelendeMacBook-Pro:bin helendai$ pip3 list
Package    Version   
---------- ----------
certifi    2019.11.28
chardet    3.0.4     
idna       2.9       
pip        20.0.2    
requests   2.23.0    
setuptools 39.0.1    
urllib3    1.25.8    
wheel      0.31.0    
HelendeMacBook-Pro:bin helendai$ python3 /Users/helendai/PycharmProjects/Demo1/test.py 
Traceback (most recent call last):
  File "/Users/helendai/PycharmProjects/Demo1/test.py", line 2, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

enter image description here

Helen Dai
  • 9
  • 1
  • 2
  • 2
    Where you've "installed it" and where the python interpreter you're running is looking could be two different things depending on how your system and each tool are configured. – Ondrej K. Mar 03 '20 at 10:57
  • 2
    Does this answer your question? [ImportError: No module named requests](https://stackoverflow.com/questions/17309288/importerror-no-module-named-requests) – ikreb Mar 03 '20 at 10:58
  • Try to check if `python3` is using `pip3` or alternatively you can check using `python3 -m pip list` to see if `requests` are installed – alikhtag Mar 03 '20 at 10:58
  • check your file header , if you have some path like /bin/python2 or anything else like this which started with # then remove it and run again , maybe you are running with python2 , and first of all try this too : **sudo apt-get install python-requests** – ben Mar 03 '20 at 12:23
  • I solve this problem with "sudo pip3 install requests --upgrade",thanks! – Helen Dai Mar 07 '20 at 03:37
  • If you already imported , you can also open and close the python shell and try to imported again – Jonathan Lorence Dec 10 '20 at 11:47

0 Answers0