首页 > 解决方案 > “加载 dynlib/dll 失败”在与 PyInstaller 绑定后执行“*.exe”文件时

问题描述

该代码在使用 CMD 执行时成功运行,但是当它*.exe使用 Pyinstaller 绑定到文件时,它会引发错误并停止执行(消息如下所示)。我通过链接路径库和其他东西尝试了所有可能的解决方案。

MatplotlibDeprecationWarning:
The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  exec(bytecode, module.__dict__)
Traceback (most recent call last):
  File "site-packages\pyinstaller-4.0.dev0-py3.7.egg\PyInstaller\loader\pyiboot01_bootstrap.py", line 167, in __init__
  File "ctypes\__init__.py", line 364, in __init__
OSError: [WinError 126] The specified module could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "try.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "C:\Users\Mohammed Hashim\AppData\Local\Programs\Python\Python37\lib\site-packages\pyinstaller-4.0.dev0-py3.7.egg\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\sklearn\__init__.py", line 80, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "C:\Users\Mohammed Hashim\AppData\Local\Programs\Python\Python37\lib\site-packages\pyinstaller-4.0.dev0-py3.7.egg\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\sklearn\_distributor_init.py", line 18, in <module>
  File "site-packages\pyinstaller-4.0.dev0-py3.7.egg\PyInstaller\loader\pyiboot01_bootstrap.py", line 169, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\MOHAMM~1\\AppData\\Local\\Temp\\_MEI38242\\sklearn\\.libs\\vcomp140.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[13968] Failed to execute script try

以前,它[11496] Failed to execute script try带有类似的错误消息。

我也特此分享我的代码。(编写此代码是为了检查缺少的库和错误消息 - 方便的错误检测)

import pandas as pd 
from sklearn import datasets

data = pd.read_csv(r"D:\PROGRAMS\DATASETS\Kang_nose_data_csv.csv")

print(data.head())

它会为 sklearn、numpy 和 pandas 以及许多其他库产生类似的错误。谢谢...!

标签: pythonmatplotlibmachine-learningpyinstallersklearn-pandas

解决方案


推荐阅读