简体   繁体   中英

"ImportError: cannot import name" with fresh Anaconda install

I am receiving the following error in an iPython notebook:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-06ac68ebf148> in <module>()
      5 import pandas as pd
      6 import numpy as np
----> 7 from sklearn import neighbours
      8 
      9 start_time = time.time()

ImportError: cannot import name neighbours

Whilst trying to run the following:

# Import required packages
import time
import pandas as pd
import numpy as np
from sklearn import neighbours

I get the same issue on the command line. My suspicions:

  • I believe my problem has something to do with my system path or environment variables. I've given this various attempts and have followed other answers (eg Python ImportError- what is wrong here? ) but in vain thus far. My current system Path variable includes the location of my python script; the environment PATH variable includes the location of the Anaconda libraries: "...\\Anaconda2\\Library\\bin;". Does this appear correct?
  • Many solutions refer to circular dependencies, which I do not believe I have in the one module.
  • Other solutions are to do with the name of the script. Mine is named 'my_solution', so I do not believe this is an issue.
  • My sklearn folder can be found in \\AppData\\Local\\Continuum\\Anaconda2\\Lib\\site-packages\\sklearn

I have recently uninstalled a standalone Python application. I have also reinstalled Anadonda and the scikit-learn, numpy and scipy packages multiple times.

I am using Python 2.7.11 through Anaconda 2.5.0 on Windows 7.

你想要邻居的美式拼写,即

from sklearn import neighbors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM