问题
I tried looking for an answer to this around the forum/google, but I can't find anything. My issue is this (from python console):
>>> import pandas
cannot import name hashtable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pandas\__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
ImportError: cannot import name hashtable //also can't import name NaT somtimes
I ran the windows 1-click installer prior to attempting the import. I'm running everything 32-bit. The pandas installer is for python 2.7.
Here's a list of modules that I have correctly imported into Python.
- setuptools
- pip
- mox
- dateutil
- six
- numpy
- SQLAlchemy
I'm on windows 7.
I also have anaconda installed, but that was really just a "hail mary" after I tried everything else. My end goal is to install the ultra-finance module. However, it seems to require pandas, hence me being stuck.
I'm a python noob, so please don't assume I know anything. Thanks.
EDIT: please let me know if I can provide any extra information.
回答1:
The recommended way to install pandas is via pip:
pip install pandas
This hashtables error arises from the cython files not being built. This error message will be more informative from 0.11.1.
回答2:
Try running your code in Spyder (Anaconda -> Spyder). It worked for me.
回答3:
Check that you have python scripts included in your system path variable. In my case I had to add "C:\Python27\Scripts"
回答4:
I was having a similar problem when downloading Pandas to my Windows 8 system. The first error I had was an egg error, but after installing some packages I think I have the solution.
First look at the previous pip errors with Pandas, make sure you have the most updated pip.
The second part is downloading wheel using
pip install wheel
After installing wheel and having the dependencies for panda and using pip it worked correctly.
来源:https://stackoverflow.com/questions/17128917/python-2-7-module-pandas-not-installing-cannot-import-name-hashtable