I am trying to make two programs. I want one to print the current weather of my city of residence and I want the other one to take data from an online account and return it. For those scripts I import the yweather module and the requests module. When I import them in the shell there are no problems but when I run the script it says "ImportError: No module named yweather". What am I doing wrong?
Shell:
>>> import requests
>>>
Script:
Traceback (most recent call last):
File "/Users/tim/Desktop/login.py", line 1, in <module>
import requests
ImportError: No module named requests
This also happens for the yweather module
Thank you
I have a same problem as you, but with package 'sklearn'.
With scikit-learn
and sklearn
installed, I run import sklearn
in a .py file and it returns "ModuleNotFoundError: No module named 'sklearn.ensemble'; 'sklearn' is not a package".
It turns out I made a funny mistake. I named the file 'sklearn.py'. So when I import sklearn
, it probably just trys to import itself. I shouldn't have named that file 'sklearn.py'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With