import pandas报错ModuleNotFoundError: No module named ‘pandas._libs.tslib‘

在导入pandas时报错,但是查询已经安装了pandas库,报错信息如下:

(py36)my@xilinx:~/ytwork/pandas-0.22.0$ pip list | grep pandas
pandas                            0.22.0
(py36)my@xilinx:~/ytwork/pandas-0.22.0$ python
Python 3.6.6 | packaged by rpi | (default, Sep  6 2018, 10:56:14)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Traceback (most recent call last):
  File "/home/my/ytwork/pandas-0.22.0/pandas/__init__.py", line 26, in <module>
    from pandas._libs import (hashtable as _hashtable,
  File "/home/my/ytwork/pandas-0.22.0/pandas/_libs/__init__.py", line 4, in <module>
    from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
ModuleNotFoundError: No module named 'pandas._libs.tslib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/my/ytwork/pandas-0.22.0/pandas/__init__.py", line 35, in <module>
    "the C extensions first.".format(module))
ImportError: C extension: No module named 'pandas._libs.tslib' 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.

根据提示,执行python setup.py build_ext --inplace --force

(py36)my@xilinx:~/ytwork/pandas-0.22.0$ python setup.py build_ext --inplace --force
running build_ext
cythoning pandas/_libs/lib.pyx to pandas/_libs/lib.c
/home/my/.conda/envs/py36/lib/python3.6/site-packages/Cython-0.29.27-py3.6-linux-armv7l.egg/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/my/ytwork/pandas-0.22.0/pandas/_libs/lib.pxd
  tree = Parsing.p_module(s, pxd, full_module_name)
cythoning pandas/_libs/properties.pyx to pandas/_libs/properties.c
/home/my/.conda/envs/py36/lib/python3.6/site-packages/Cython-0.29.27-py3.6-linux-armv7l.egg/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/my/ytwork/pandas-0.22.0/pandas/_libs/properties.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
... ...

编译好后,再次导入pandas,没有报错

  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值