没有名为'pandas._libs.tslib'的模块

发布于 2021-01-29 14:56:43

我不能进口大熊猫

 C:\Users\Yash\Desktop\Python\Twitter Sentimental Analysis>python import.py
Traceback (most recent call last):
  File "C:\Users\Yash\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\__init__.py", line 26, in <module>
    from pandas._libs import (hashtable as _hashtable,
  File "C:\Users\Yash\AppData\Local\Programs\Python\Python36\lib\site-packages\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 "import.py", line 4, in <module>
    import pandas as pd
  File "C:\Users\Yash\AppData\Local\Programs\Python\Python36\lib\site-packages\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.

我尝试拧螺丝,但此错误保持不变。我已经更新了模块以及pip和python!

这是命令的完整回溯。

我目前正在使用python 3.6.6(从官方网站下载)

pip版本:在Windows 10笔记本电脑上运行的18.1 !!

关注者
0
被浏览
95
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

    我遇到了类似的问题,并通过手动卸载pandas然后使用pip安装pandas解决了该问题。您提到您只更新了熊猫。因此,我想您没有尝试重新安装它。

    这样做时,我的环境中的熊猫版本从0.23.4更改为0.24.1

    我的环境:

    python 3.6.7

    点18.1

    注意:我也是Python使用的初学者。更有经验的用户可能知道更好的方法。

    pip uninstall pandas
    pip install pandas
    

    以上步骤解决了我的问题,并且能够导入熊猫。

    我在pandas社区中检查了发行说明,看来对tslib的依赖性已被删除。检查以下链接中的1.5节,并搜索tslib。

    http://pandas.pydata.org/pandas-
    docs/version/0.24/pandas.pdf



知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看