在ipython和Jupyter上导入熊猫失败

Jb_Eyd

几天来,我一直在遇到以下熊猫问题:使用spyder时可以导入熊猫,但是当使用ipythonjupyter时无法使用我一直在寻找解决这个问题的几个方向:

  • 我更新了熊猫
  • 我已经检查过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.

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

Jb_Eyd

我找到了解决方案:由于编码问题,该错误来自值错误。

它在python中发生了很多,并且已经问了各种各样的问题。其中,以下链接对此进行了仔细解释:

Pelican 3.3 pelican-quickstart错误“ ValueError:未知语言环境:UTF-8”

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

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章