Python DLL导入错误,找不到模块

时间:2020-04-23 11:10:29

标签: python-3.x pandas dll

我正在尝试通过 pycharms-2020.1 x64 在Intel i7 PC上运行脚本 python-3.7.7.amd64

我下载了 Winpython64-3.7.7.0 应用程序,运行它并将文件复制到C:\Program Files。 当我选择解释器时,会引起问题的导入包(pandas)已包括在内,并且可以在站点包中找到。

该脚本具有用于熊猫的导入语句;

import pandas as pd

from pandas import ExcelWriter

,错误消息是;

"C:\Program Files\WinPython64\python-3.7.7.amd64\python.exe" 
    C:/Users/USER/Documents/Python_Code/Python3.6/Smartcharge_Data/Mean_Smartpings/Mean_Smart_Excel_v4.py
    Traceback (most recent call last):
      File 
 "C:/Users/USER/Documents/Python_Code/Python3.6/Smartcharge_Data/Mean_Smartpings/Mean_Smart_Excel_v4.py", 
  line 9, in <module>
        import pandas as pd
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\__init__.py", line 
    55, in <module>
        from pandas.core.api import (
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\core\api.py", line 
   29, in <module>
        from pandas.core.groupby import Grouper, NamedAgg
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site- 
   packages\pandas\core\groupby\__init__.py", line 1, in <module>
        from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site- 
   packages\pandas\core\groupby\generic.py", line 60, in <module>
        from pandas.core.frame import DataFrame
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\core\frame.py", line 
   124, in <module>
        from pandas.core.series import Series
       File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\core\series.py", 
   line 4572, in <module>
        Series._add_series_or_dataframe_operations()
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\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:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site- 
   packages\pandas\core\window\__init__.py", line 1, in <module>
        from pandas.core.window.ewm import EWM  # noqa:F401
      File "C:\Program Files\WinPython64\python-3.7.7.amd64\Lib\site-packages\pandas\core\window\ewm.py", 
   line 5, in <module>
        import pandas._libs.window.aggregations as window_aggregations
    ImportError: DLL load failed: The specified module could not be found.

    Process finished with exit code 1

我尝试添加DLL的文件路径 (即C:\ Program Files \ WinPython64 \ python-3.7.7.amd64 \ DLLs) 进入用户变量中的路径并重新启动,但这不起作用。

我还没有包含整个Python脚本,因为它与python-3.7.1-amd64和pycharms-20183.3.5 x64完美兼容,所以我认为脚本不是问题。

如果尝试通过pip安装熊猫,则表示已经满足此要求。

如果我卸载了熊猫,则错误消息会大大缩短,如附件中的图像所示。 Short error code, no module found

运行一个使用熊猫的简单脚本;

dict = {"country": ["Brazil", "Russia", "India", "China", "South Africa"],
        "capital": ["Brasilia", "Moscow", "New Dehli", "Beijing", "Pretoria"],
        "area": [8.516, 17.10, 3.286, 9.597, 1.221],
       "population": [200.4, 143.5, 1252, 1357, 52.98] }

import pandas as pd

brics = pd.DataFrame(dict)

print(brics)

使用IDLE(Python GUI)可以正常工作。

安装Python的方法已在其他几台计算机上成功运行。

有人有什么想法吗?我问过我的工作同事,但无济于事。

1 个答案:

答案 0 :(得分:0)

感谢Nullman的评论,我现在已经解决了该问题。我在这里停了一个vc_redist_x64.exe;

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

如本页底部的建议;

https://winpython.github.io/

谢谢