Cannot import Scikit-Learn

假装没事ソ 提交于 2019-11-27 23:08:34
mgibsonbr

I'm not really sure, but according to this that error happens when a package that depends on numpy is compiled targeting a specific version (or a specific platform), and that package is then installed in a different environment. How did you install those two packages? (numpy and scipy)

I'd suggest uninstalling both and then reinstalling SciPy, either using pip or from source.

pixel_warrior

I ran into this today on OS X El Capitan. Unfortunately, reinstalling/installing didn't work, since the problem ended up being that numpy installation native to OS X was preferred over the one being installed by pip.

I was able to solve this by following the guidance in: https://apple.stackexchange.com/a/223163

In particular, I used the approach of fixing the python path to prefer pip libraries over OS X native libraries:

Create a file called fix_mac_path.pth in /Library/Python/2.7/site-packages that has the following:

import sys; std_paths=[p for p in sys.path if p.startswith('/System/')]; sys.path=[p for p in sys.path if not p.startswith('/System/')]+std_paths

i was having the exact same problem. I managed to make it work by installing the windows binary for 64 bit windows from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn . Hope this works for you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!