我是Python的新手,目前导入某些库时遇到了麻烦。
我正在使用Python 3.8。
我已经使用“ pip install pandas”在CMD中安装了熊猫
如果我转到Python文件夹,我会看到已安装Pandas:
C:\ Users \ VALENTINA \ AppData \ Local \ Programs \ Python \ Python38-32 \ Lib \ site-packages
但是当我尝试在脚本中导入熊猫时,我收到此错误消息:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pandas as pd
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\__init__.py", line 55, in <module>
from pandas.core.api import (
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\api.py", line 29, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\generic.py", line 60, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 124, in <module>
from pandas.core.series import Series
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\series.py", line 4572, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations
from pandas.core.window import EWM, Expanding, Rolling, Window
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\__init__.py", line 1, in <module>
from pandas.core.window.ewm import EWM # noqa:F401
File "C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\ewm.py", line 5, in <module>
import pandas._libs.window.aggregations as window_aggregations
ImportError: DLL load failed while importing aggregations: The specified module could not be found.
在Visual Code和IDLE中运行脚本时出现此错误消息。
我很高兴有人可以帮助我
Thinks
答案 0 :(得分:21)
我面临着同样的问题。我正在使用python 3.7.5
。默认情况下,pip install pandas
命令安装版本1.0.3。所以我恢复到版本1.0.1。
pip uninstall pandas
pip install pandas==1.0.1
现在它可以正常工作了。您可以尝试一下。
答案 1 :(得分:6)
您也可以尝试安装Microsoft Visual C ++ Redistributable的较新版本。
例如(2015-2019)
我遇到了同样的问题,安装上述解决了该问题。
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
答案 2 :(得分:1)
我在导入熊猫时收到两条错误消息,其中一条在OP中,另一条在
AttributeError: module 'pandas' has no attribute 'plotting'
我能够通过重新安装软件包/库来缓解问题
pip uninstall pandas
pip install pandas==1.0.1
另一个用户在我面前指出。我现在将Python 3.8.2与熊猫1.0.1结合使用而没有打ic。
答案 3 :(得分:1)
只需卸载熊猫并将熊猫重新安装到1.0.1
例如:
pip卸载pandas
pip install pandas == 1.0.1