我使用pyinstaller创建了一个exe(我正在使用python 3.7.6和pyinstaller 3.6),使用
pyinstaller --onefile --icon=icon.ico my_script.py
(即使pyinstaller --onedir --icon=icon.ico my_script.py
,问题也相同] >>
该exe程序运行良好,但是在执行过程中出现多个错误:
25484 INFO: Excluding import 'PyQt5' 25486 INFO: Removing import of PyQt5 from module PIL.ImageQt 25487 INFO: Import to be excluded not found: 'FixTk' 25488 INFO: Excluding import 'tkinter' 25490 INFO: Removing import of tkinter from module PIL.ImageTk 25491 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"... 25496 INFO: Excluding import 'tkinter' 25498 INFO: Import to be excluded not found: 'FixTk' 25499 INFO: Loading module hook "hook-pkg_resources.py"... 26227 INFO: Processing pre-safe import module hook win32com 26524 INFO: Excluding import '__main__' 26525 INFO: Removing import of __main__ from module pkg_resources
尽管存在这些错误,但是exe在某些计算机上可以正常工作,而在某些计算机上却不能。在不起作用的地方,我在启动时收到此错误:
Traceback (most recent call last): File "my_script.py", line 39, in <module> File "c:\users\valerio\appdata\local\programs\python\python37-32\lib\site-pack ages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module File "site-packages\cv2\__init__.py", line 3, in <module> ImportError: DLL load failed: The specified module could not be found. [2800] Failed to execute script my_script
所以我的问题是:
为什么会出现内置错误?
为什么在某些计算机上工作正常,而另一些则不能?这第二个问题真的让我发疯。
谢谢
我使用pyinstaller --onefile --icon = icon.ico my_script.py(使用pyinstaller --onedir创建了pyinstaller(我正在使用python 3.7.6和pyinstaller 3.6)创建了一个exe。图标= ...
我找到了问题的答案。如果有人需要,我在这里写下。问题仅出现在Windows Server 2008和2012上。它们缺少名为“桌面体验”的模块。