【发布时间】:2018-12-27 07:43:21
【问题描述】:
import pandas as pd
导入熊猫时出现以下错误。谁能帮助我我对python比较陌生。我为此使用树莓派,安装的操作系统是 raspbian os。
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/usr/local/lib/python3.5/dist-packages/pandas/__init__.py in <module>()
25 try:
---> 26 from pandas._libs import (hashtable as _hashtable,
27 lib as _lib,
/usr/local/lib/python3.5/dist-packages/pandas/_libs/__init__.py in <module>()
3
----> 4 from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
5
ImportError: cannot import name 'iNaT'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-3-7dd3504c366f> in <module>()
----> 1 import pandas as pd
/usr/local/lib/python3.5/dist-packages/pandas/__init__.py in <module>()
33 "pandas from the source directory, you may need to run "
34 "'python setup.py build_ext --inplace --force' to build "
---> 35 "the C extensions first.".format(module))
36
37 from datetime import datetime
ImportError: C extension: 'iNaT' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
【问题讨论】:
-
你是如何安装 pandas 的?您从哪个目录运行脚本/Python 提示符?
-
你安装了pandas吗?如果不是先在你的 pi 中尝试这个命令,
~ $ pip install pandas -
我使用sudo pip install pandas安装pandas,目录是/home/pi
-
重复问题,请查看答案here
标签: python python-3.x pandas raspberry-pi raspbian