没有名为“pandas._libs.tslib”的模块

Yas*_*oni 11 python module pip pandas

我无法导入熊猫

 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.
Run Code Online (Sandbox Code Playgroud)

我试图搞砸,但这个错误保持不变。我已经更新了模块以及 pip 和 python!

这是命令的完整回溯。

我目前使用的是python 3.6.6(从官网下载)

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

nit*_*685 14

我遇到了类似的问题,并通过手动卸载熊猫然后使用 pip 安装熊猫来解决它。您已经提到您只更新了熊猫。所以我假设你还没有尝试重新安装它。

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

我的环境:

蟒蛇 3.6.7

点 18.1

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

pip uninstall pandas
pip install pandas 
Run Code Online (Sandbox Code Playgroud)

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

我查看了 Pandas 社区的发行说明,似乎已经删除了对 tslib 的依赖。检查以下链接中的第 1.5 节并搜索 tslib。

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


mus*_*cak 5

我遇到了同样的错误并通过调用以下命令解决了它:

pip uninstall pandas  
pip install pandas
pip3 install --upgrade pandas
Run Code Online (Sandbox Code Playgroud)