Reputation: 169
So I want to import scipy.stats, for whatever reason when I type :
import scipy
it works just fine, no error, but when I type :
import scipy.stats
Suddenly I got an error :
C:\Python34\python.exe "G:/Python Practice/Gui Int/apa.py"
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "G:/Python Practice/Gui Int/apa.py", line 2, in <module>
import scipy.stats
ImportError: No module named 'scipy.stats'; 'scipy' is not a package
I try another such as scipy.io and it's error as well, can I ask what is wrong? is my scipy installation broken or something?? Thank you very much
Upvotes: 1
Views: 7030
Reputation: 78536
The last part of the error clearly shows one of the files in your directory setup is shadowing the scipy
package:
'scipy' is not a package
Well, scipy
is a package.
You have a file called scipy.py
in your directory, and that's why the first import works while the second does not.
Upvotes: 2