【问题标题】:Import error while import pandas导入熊猫时出现导入错误
【发布时间】: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


【解决方案1】:

这样安装:

sudo apt install python3-pandas

【讨论】:

    猜你喜欢
    • 2020-04-05
    • 2020-09-25
    • 2023-04-01
    • 2021-10-12
    • 2015-06-10
    • 2020-04-24
    • 2019-02-01
    • 1970-01-01
    相关资源
    最近更新 更多