Pandas 在 ipython 和 Jupyter 上导入失败

Pandas importation fails on ipython and Jupyter

几天来我一直在使用 pandas 遇到以下问题:我可以在使用 spyder[= 时导入 pandas 32=] 但是当我使用 ipythonjupyter 时它不起作用。我一直在寻找解决问题的几个方向:

  • 我更新了pandas,
  • 我检查过 ipythonspyder 具有相同的 pythonpath ,
  • 我已经卸载并重新安装了 spyder

它仍然不起作用,我收到以下错误消息:

ImportError                               Traceback (most recent call last)
<ipython-input-8-d6ac987968b6> in <module>()
----> 1 import pandas

/Users/ME/anaconda/lib/python2.7/site-packages/pandas/__init__.py in <module>()
     29                       "pandas from the source directory, you may need to run "
     30                       "'python setup.py build_ext --inplace' to build the C "
---> 31                       "extensions first.".format(module))
     32 
     33 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.

我看到其他人也有同样的问题,但没有明确的答案。有谁知道解决它的程序?

我找到了解决方案:错误来自编码问题导致的值错误。

它在 python 中发生了很多次,并且已经提出了各种问题。其中,以下link仔细解释一下:

Pelican 3.3 pelican-quickstart error "ValueError: unknown locale: UTF-8"

简而言之,只需运行以下bash代码即可解决问题:

echo -e "export LC_ALL=en_US.UTF-8\nexport LANG=en_US.UTF-8" >> ~/.bashrc && source ~/.bashrc