How to solve import error for pandas using iPython Notebook on Windows?

匿名 (未验证) 提交于 2019-12-03 02:26:02

问题:

I'm trying to import pandas while using iPython. My overall purpose is to use XLwings.

I'm on Windows 7 and have used Anaconda to install Python, pandas and all the dependencies.

Here is my code:

from pandas import DataFrame 

Which gives:

ImportError                               Traceback (most recent call last) <ipython-input-7-26dfcabfb474> in <module>() ----> 1 from pandas import DataFrame  C:\Users\Accounting\Anaconda\lib\site-packages\pandas\__init__.py in <module>()      11                       "pandas from the source directory, you may need to run "      12                       "'python setup.py build_ext --inplace' to build the C " ---> 13                       "extensions first.".format(module))      14       15 from datetime import datetime  ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first. 

Can anyone with experience of using Python/pandas in iPython on Windows help me understand how to solve this error?

Specifically where do I run "python setup.py build_ext --inplace"?

Thanks!

回答1:

As posted by Jeff in the comments:

There is a bug in older versions (of conda) where if you had updated pandas WHILE it was being used it didn't update correctly. Try closing all python processes, then

conda remove pandas  conda install pandas 


回答2:

I found while installing packages (most from Christoph Gohlke), sometimes you have to use "pip install name of .whl" (in proper path to package) and initially adding a "C:/miscutilities" to Environmental Variables PATH if it wouldn't install from the Anaconda -> Lib -> site-packages. Then some other packages I used conda.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!