没有名为“pandas._libs.tslib”的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54093020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No module named 'pandas._libs.tslib'
提问by Yash Soni
I am not able to import pandas
我无法导入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.
I tried screwing around but this error stayed the same. I have updated the modules already along with pip and python!
我试图搞砸,但这个错误保持不变。我已经更新了模块以及 pip 和 python!
This is the full traceback of the command.
这是命令的完整回溯。
I am currently using python 3.6.6 (downloaded from the official site)
我目前使用的是python 3.6.6(从官网下载)
pip version : 18.1 running on windows 10 laptop!!
pip 版本:18.1 在 Windows 10 笔记本电脑上运行!!
回答by nitin3685
I faced a similar issue and solved it by manually uninstalling pandas and then installing pandas using pip. You have mentioned that you have only updated pandas. So I assume you haven't tried re-installing it.
我遇到了类似的问题,并通过手动卸载Pandas然后使用 pip 安装Pandas来解决它。您已经提到您只更新了Pandas。所以我假设你还没有尝试重新安装它。
While doing so pandas version in my environment changed from 0.23.4 to 0.24.1
这样做时,我环境中的Pandas版本从 0.23.4 更改为 0.24.1
My Environment :
我的环境:
python 3.6.7
蟒蛇 3.6.7
pip 18.1
点 18.1
Note : I am also a beginner in Python usage. More experienced users may know a better way.
注意:我也是 Python 使用的初学者。更有经验的用户可能知道更好的方法。
pip uninstall pandas
pip install pandas
The above steps solved my issues and I am able to import pandas.
上述步骤解决了我的问题,我能够导入Pandas。
I checked the release notes in pandas community and it seems like the dependency on tslib has been removed. Check section 1.5 in the below link and search for tslib.
我查看了 Pandas 社区的发行说明,似乎已经删除了对 tslib 的依赖。检查以下链接中的第 1.5 节并搜索 tslib。
http://pandas.pydata.org/pandas-docs/version/0.24/pandas.pdf
http://pandas.pydata.org/pandas-docs/version/0.24/pandas.pdf
回答by mustafa can nacak
I faced the same error and resolved it by calling the following commands:
我遇到了同样的错误并通过调用以下命令解决了它:
pip uninstall pandas
pip install pandas
pip3 install --upgrade pandas