简体   繁体   中英

Import scipy.stats error

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

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM