gpt4 book ai didi

python - 导入错误 : cannot import name '_ccallback_c'

转载 作者:太空狗 更新时间:2023-10-29 16:57:54 25 4
gpt4 key购买 nike

最初我遇到这个错误(没有找到模块名称 scipy)所以我安装了一个 Scipy wheel 文件。现在我不再遇到同样的错误,但我得到了 cannot import name "_ccallback_c"

错误似乎是在第四行代码处触发的。我做了我的研究,看到其他人建议尝试像 Anaconda 这样的环境。我已经看到它在闲置时工作,并且该解决方案对我来说并不理想。

回溯:

Traceback (most recent call last):
File "C:\Users\joesh\Desktop\Python\Machine Learning\1st tutorial.py", line 4, in <module>
from sklearn import preprocessing, cross_validation, svm
File "C:\Users\joesh\Desktop\Python\lib\site-packages\sklearn\__init__.py", line 134, in <module>
from .base import clone
File "C:\Users\joesh\Desktop\Python\lib\site-packages\sklearn\base.py", line 10, in <module>
from scipy import sparse
File "C:\Users\joesh\Desktop\Python\lib\site-packages\scipy\__init__.py", line 118, in <module>
from scipy._lib._ccallback import LowLevelCallable
File "C:\Users\joesh\Desktop\Python\lib\site-packages\scipy\_lib\_ccallback.py", line 1, in <module>
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c'

和代码:

import pandas as pd
import quandl, math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression

最佳答案

我在 USING Anaconda 上遇到了同样的错误,所以我不确定使用它是否会有任何不同。我通过卸载 scipy 并使用 pip 重新安装它来解决它:

pip uninstall scipy 

您会收到此消息:

Uninstalling scipy-1.1.0: Would remove: c:\users\thesh\appdata\local\programs\python\python36-32\lib\site-packages\scipy-1.1.0.dist-info* c:\users\thesh\appdata\local\programs\python\python36-32\lib\site-packages\scipy* Proceed (y/n)?

y,pip 完成后,输入:

pip install scipy

关于python - 导入错误 : cannot import name '_ccallback_c' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46721713/

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