gpt4 book ai didi

python - AttributeError:模块“scipy”在sklearn/utils/fixes.py中没有属性“sparse”

转载 作者:太空宇宙 更新时间:2023-11-03 21:00:07 30 4
gpt4 key购买 nike

我已经更新了sklearn,scipy(以前一切正常。)。当前版本:

python: 3.6.8
scikit-learn 0.20.3
numpy: 1.16.2
scipy: 1.2.1


结果,该错误开始发生:

  File "....projects/Test.py", line 8, in <module>
from sklearn import datasets

File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\__init__.py", line 64, in <module>
from .base import clone

File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\base.py", line 14, in <module>
from .utils.fixes import signature

File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
from .fixes import _Sequence as Sequence

File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line 20, in <module>
import scipy.sparse as sp

AttributeError: module 'scipy' has no attribute 'sparse'


我试图重新安装sklearn,scipy,但没有帮助。

无效的示例代码:

from sklearn import datasets

iris = datasets.load_iris()

最佳答案

重新安装scikit-learn,scipy和numpy后,问题已解决

关于python - AttributeError:模块“scipy”在sklearn/utils/fixes.py中没有属性“sparse”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55760112/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com