Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
239 views
in Technique[技术] by (71.8m points)

python - ImportError: cannot import name '_ccallback_c'

Initially I was getting this error (No Module name was found scipy) So I installed a Scipy wheel file. Now I don't get the same error any more but I get cannot import name "_ccallback_c".

The error seems to be triggered at the fourth line of code. I have done my research and saw that other people suggested to try an environment such as Anaconda. I have seen it work on idle, and that solution isn't ideal for me.

Traceback:

Traceback (most recent call last):
  File "C:UsersjoeshDesktopPythonMachine Learning1st tutorial.py", line 4, in <module>
    from sklearn import preprocessing, cross_validation, svm
  File "C:UsersjoeshDesktopPythonlibsite-packagessklearn\__init__.py", line 134, in <module>
    from .base import clone
  File "C:UsersjoeshDesktopPythonlibsite-packagessklearnase.py", line 10, in <module>
    from scipy import sparse
  File "C:UsersjoeshDesktopPythonlibsite-packagesscipy\__init__.py", line 118, in <module>
    from scipy._lib._ccallback import LowLevelCallable
  File "C:UsersjoeshDesktopPythonlibsite-packagesscipy\_lib\_ccallback.py", line 1, in <module>
    from . import _ccallback_c
ImportError: cannot import name '_ccallback_c'

And the code:

import pandas as pd
import quandl, math
import numpy as np
from sklearn import preprocessing, cross_validation, svm 
from sklearn.linear_model import LinearRegression
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same error on USING Anaconda, so I am not sure if using it would make any difference. I solved it by just uninstalling scipy and re-installing it using pip:

pip uninstall scipy 

you'll get this message:

Uninstalling scipy-1.1.0: Would remove: c:usersheshappdatalocalprogramspythonpython36-32libsite-packagesscipy-1.1.0.dist-info* c:usersheshappdatalocalprogramspythonpython36-32libsite-packagesscipy* Proceed (y/n)?

press y, and after pip is done, type:

pip install scipy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...