我正在尝试学习sklearn,当我运行import sklearn
时遇到以下错误。但是,当我使用python 2.7运行完全相同的代码时,我没有遇到任何错误。
import sklearn
File "/usr/local/lib/python3.2/dist-packages/sklearn/__init__.py", line 38, in <module>
from .base import clone
File "/usr/local/lib/python3.2/dist-packages/sklearn/base.py", line 10, in <module>
from scipy import sparse
File "/usr/lib/python3/dist-packages/scipy/__init__.py", line 124, in <module>
pkgload(verbose=SCIPY_IMPORT_VERBOSE,postpone=True)
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 177, in __call__
for package_name in self._get_sorted_names():
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 114, in _get_sorted_names
for name in depend_dict.keys():
RuntimeError: dictionary changed size during iteration
我做了一些googl'ing并按照以下链接中的说明运行sudo pip3 install git+https://github.com/scikit-learn/scikit-learn.git
。安装顺利,然而,我继续得到错误。
https://askubuntu.com/questions/449326/installation-error-in-sklearn-for-python3
如何解决此问题。 (除了使用Python2.7)
答案 0 :(得分:1)
这是一个将在下一个NumPy(v 1.9.0)版本中修复的错误:
https://github.com/numpy/numpy/commit/5025c40965fa5fb2b591f07c152b966dc7b730f0
github上已经有一个补丁,但它还没有捆绑到补丁版本中。你的选择: