pandas 导入错误:导入聚合时 DLL 加载失败:找不到指定的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/60767017/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 06:25:42  来源:igfitidea点击:

ImportError: DLL load failed while importing aggregations: The specified module could not be found

pythonpandasvisual-studio-code

提问by Valentina Caffera

I am new to Python and currently having trouble when importingsome libraries.

我是 Python 新手,目前在导入某些库时遇到问题。

I am using Python 3.8.

我正在使用 Python 3.8。

I have installed Pandas in the CMD using "pip install pandas"

我已经使用“pip install pandas”在 CMD 中安装了 Pandas

If i go to Python folder i see that Pandas is installed:

如果我转到 Python 文件夹,我会看到 Pandas 已安装:

C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\Lib\site-packages

C:\Users\VALENTINA\AppData\Local\Programs\Python\Python38-32\Lib\site-packages

But then i get this error message when trying to import Pandas in my script:

但是当我尝试在我的脚本中导入 Pandas 时收到此错误消息:

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.

I have this error message when running my script in Visual Code and also in IDLE.

在 Visual Code 和 IDLE 中运行我的脚本时出现此错误消息。

I appreciate if someone can help me

如果有人可以帮助我,我很感激

Thnks

谢谢

回答by Nazem Mahmud

I was facing the same problem. I am using python 3.7.5. By default pip install pandascommand install version 1.0.3. So i revert to version 1.0.1.

我面临着同样的问题。我正在使用python 3.7.5. 默认pip install pandas命令安装版本 1.0.3。所以我恢复到 1.0.1 版。

pip uninstall pandas
pip install pandas==1.0.1

Now it is working without error. You may try it.

现在它可以正常工作了。你可以试试。

回答by watupzack

You may also try to install a fresher version of Microsoft Visual C++ Redistributable.

您也可以尝试安装更新版本的 Microsoft Visual C++ Redistributable。

E.g. (2015-2019)

例如(2015-2019)

I had the same problem, and installing the aforementioned resolved it.

我有同样的问题,安装上述解决了它。

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

回答by sasha

There are two error messages I have received in importing pandas, the one in the OP and the other one being

我在导入Pandas时收到两条错误消息,一条在 OP 中,另一条是

AttributeError: module 'pandas' has no attribute 'plotting'

I was able to mitigate the issues by reinstalling the package/library

我能够通过重新安装包/库来缓解这些问题

pip uninstall pandas
pip install pandas==1.0.1

as another user pointed out before me. I am using Python 3.8.2 in conjunction with pandas 1.0.1 without hiccup now.

正如另一位用户在我面前指出的那样。我现在将 Python 3.8.2 与 pandas 1.0.1 结合使用,没有出现问题。