使用pyinstaller编译可执行文件时发现缺少莳萝

时间:2020-05-16 07:42:05

标签: python pyinstaller

我使用sklearn,numpy和pandas构建了一个小程序,我尝试编译该文件,但失败了,并显示以下错误消息,它说某些位置缺少dll文件。我看着这个thread

  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 174, in __init__
  File "ctypes\__init__.py", line 373, in __init__
FileNotFoundError: Could not find module 'C:\Users\Dennis\AppData\Local\Temp\_MEI101722\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sklearn111.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\dennis\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\sklearn\__init__.py", line 78, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\dennis\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\sklearn\_distributor_init.py", line 18, in <module>
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 176, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\Dennis\\AppData\\Local\\Temp\\_MEI101722\\sklearn\\.libs\\vcomp140.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[6572] Failed to execute script gui_plus_model

因此,我将所需的dll与要编译的.py文件放在同一文件夹中,但是存在相同的错误。 python的版本是3.8,所有必需的模块已经升级到最新版本。

pyinstaller -F --add-binary "vcomp140.dll;.dll" gui_plus_model.py

0 个答案:

没有答案