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

标签 python pandas 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.

我试着搞砸了,但这个错误仍然存​​在。 我已经更新了模块以及 pip 和 python!

这是命令的完整回溯。

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

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

最佳答案

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

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

我的环境:

python 3.6.7

18.1 pip

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

pip uninstall pandas
pip install pandas 

上述步骤解决了我的问题,我可以导入 pandas。

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

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

关于python - 没有名为 'pandas._libs.tslib' 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54093020/

相关文章:

javascript - 创建可导出对象或模块以使用 CommonJS/NodeJS javascript 包装第三方库

python - 以编程方式编辑 Photoshop PSD 文本图层

python - 错误: Internal Python error in the inspect module

python - 基于Python中的键聚合字典列表上的值

python - 有没有办法替换长度超过X位的单词的最后N个字母?

python - Pandas:如果组的大小大于平均值,则删除行

python - 在 Pandas 中使用 merge() 方法时收到 TypeError

python - Pandas ,数据帧 : Splitting one column into multiple columns

mysql - 与简单地将 mysql_auto_reconnect 设置为 1 相比,使用 DBIx::Connector 有什么优势?

python - 访问 "module scope"变量