【PyQt】使用 pyinstaller 构建 exe

首先可能需要安装一下 PyInstaller:

pip install pyinstaller

PyInstaller 的官方文档:PyInstaller Manual
构建命令:

pyinstaller [opt] [要打包的程序.py]

可选的 opt 有:

  • -D, -–onedir 创建一个目录,包含exe文件,但会依赖很多文件(默认选项)。
  • -F, -–onefile 打包成一个exe文件。
  • -c, –console, –nowindowed 使用控制台,无界面(默认)
  • -w, -–windowed, –noconsole 使用窗口,无控制台

构建过程中得到的 WARNING 及解决方法:

  • ctypes imports are only supported using bare filenames
    去掉引用 DLL 前面的路径或是 ./
  • lib not found: mfc90.dll dependency of 路径\ControlCAN.dll
  • lib not found: MSVCR90.dll dependency of 路径\ControlCAN.dll
  • One binary added with two internal names.
    29025 WARNING: ('libGLESv2.dll',
     'D:\\python37\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
     'BINARY')
    
  • was placed previously at
    29026 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll',
     'D:\\python37\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
     'BINARY')
    
  • failed to execute script
    有人说是编码的问题,改成 GBK 试试……然而依旧不行
    λ pchcp
    活动代码页: 936
    

换自己的笔记本上打包,更不得了了……可能公司电脑什么乱七八糟的都装上了,所以对于依赖项感受不到,这换到新环境,问题一下子就暴露出来了

$ pyinstaller -Fw main.py
249 INFO: PyInstaller: 3.4
249 INFO: Python: 3.7.3
249 INFO: Platform: Windows-10-10.0.17763-SP0
265 INFO: wrote E:\qt\pyqt\CANdataSender\main.spec
265 INFO: UPX is not available.
281 INFO: Extending PYTHONPATH with paths
['E:\\qt\\pyqt\\CANdataSender', 'E:\\qt\\pyqt\\CANdataSender']
281 INFO: checking Analysis
281 INFO: Building Analysis because Analysis-00.toc is non existent
296 INFO: Initializing module dependency graph...
296 INFO: Initializing module graph hooks...
296 INFO: Analyzing base_library.zip ...
8202 INFO: running Analysis Analysis-00.toc
8265 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python\python.exe
8311 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\python.exe
8405 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\python.exe
8468 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\python.exe
8514 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\python.exe
8577 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\python\python.exe
8655 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\python\VCRUNTIME140.dll
8702 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\VCRUNTIME140.dll
8764 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\VCRUNTIME140.dll
8811 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\VCRUNTIME140.dll
8874 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\VCRUNTIME140.dll
8983 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\python\python37.dll
9030 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\python37.dll
9093 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\python\python37.dll
9155 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\python\python37.dll
9202 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\python\python37.dll
9264 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\python\python37.dll
9311 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\python37.dll
9374 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\python37.dll
9436 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\python37.dll
9483 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\python\python37.dll
9546 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\python37.dll
9608 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\python\python37.dll
9639 INFO: Caching module hooks...
9639 INFO: Analyzing E:\qt\pyqt\CANdataSender\main.py
9764 INFO: Loading module hooks...
9764 INFO: Loading module hook "hook-encodings.py"...
9936 INFO: Loading module hook "hook-pydoc.py"...
9936 INFO: Loading module hook "hook-PyQt5.py"...
10452 WARNING: Hidden import "sip" not found!
10452 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
11342 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
13624 INFO: Loading module hook "hook-xml.py"...
14139 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
15030 INFO: Looking for ctypes DLLs
15030 INFO: Analyzing run-time hooks ...
15045 INFO: Including run-time hook 'pyi_rth_qt5.py'
15045 INFO: Looking for dynamic libraries
15155 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libEGL.dll
15389 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platformthemes\qxdgdesktopportal.dll
15451 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platformthemes\qxdgdesktopportal.dll
15545 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwebp.dll
15608 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwebp.dll
15670 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwebp.dll
15717 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwebp.dll
15858 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qsvg.dll
15905 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qsvg.dll
15998 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
16061 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
16123 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
16170 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
16233 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qjpeg.dll
17279 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qico.dll
17342 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qico.dll
17420 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtga.dll
17483 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtga.dll
17545 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtga.dll
17608 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
17670 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
17733 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
17795 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
17842 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
17904 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
17967 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
18029 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qminimal.dll
18139 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18201 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18264 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18311 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18373 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18436 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18498 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18561 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll
18670 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
18717 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
18779 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
18842 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
18889 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
18951 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
19014 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
19076 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qoffscreen.dll
19170 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwbmp.dll
19217 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qwbmp.dll
19311 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19373 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19436 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19482 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19545 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19607 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19654 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19717 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qtiff.dll
19826 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
19873 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
19967 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
20029 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
20076 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
20139 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
20201 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
20357 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\styles\qwindowsvistastyle.dll
20420 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\styles\qwindowsvistastyle.dll
20592 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qicns.dll
20639 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qicns.dll
20701 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qicns.dll
20826 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\iconengines\qsvgicon.dll
20873 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\iconengines\qsvgicon.dll
20951 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwebgl.dll
21232 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwebgl.dll
21295 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwebgl.dll
21357 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwebgl.dll
21420 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\platforms\qwebgl.dll
21529 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll
21576 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll
21639 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll
21717 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\DLLs\_ssl.pyd
21795 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\_ssl.pyd
21873 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\_ssl.pyd
21935 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\DLLs\pyexpat.pyd
21998 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\python\DLLs\pyexpat.pyd
22060 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\DLLs\pyexpat.pyd
22107 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\pyexpat.pyd
22170 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\pyexpat.pyd
22279 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\DLLs\unicodedata.pyd
22342 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\unicodedata.pyd
22404 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\unicodedata.pyd
22482 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\_hashlib.pyd
22560 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\DLLs\_bz2.pyd
22623 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\_bz2.pyd
22685 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\DLLs\_bz2.pyd
22748 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\DLLs\_bz2.pyd
22795 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\_bz2.pyd
22873 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\DLLs\_lzma.pyd
22935 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\_lzma.pyd
22998 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\_socket.pyd
23060 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\_socket.pyd
23123 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\select.pyd
23185 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtCore.pyd
23248 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtCore.pyd
23310 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtCore.pyd
23373 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtCore.pyd
23451 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\sip.pyd
23513 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\sip.pyd
23560 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\sip.pyd
23623 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\sip.pyd
23685 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtWidgets.pyd
23748 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtWidgets.pyd
23826 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtGui.pyd
23888 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\QtGui.pyd
23982 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\DLLs\_ctypes.pyd
24045 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\_ctypes.pyd
24107 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\_ctypes.pyd
24170 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24216 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24279 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24341 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24404 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24451 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24513 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\libGLESv2.dll
24576 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5dbus.dll
24638 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5dbus.dll
24685 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5dbus.dll
24795 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
24857 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
24920 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
24982 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
25029 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
25091 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
25154 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
25201 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5gui.dll
25295 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25357 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25404 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25466 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25529 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25591 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25638 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25701 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25763 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25826 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5core.dll
25888 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5svg.dll
25951 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5svg.dll
26013 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5svg.dll
26076 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5svg.dll
26169 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26232 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26294 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26341 WARNING: lib not found: api-ms-win-crt-multibyte-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26404 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26466 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26513 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26576 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26638 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26701 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26748 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26810 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of C:\python\lib\site-packages\PyQt5\Qt\bin\MSVCP140.dll
26888 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
26951 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
27013 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
27076 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5widgets.dll
27185 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5quick.dll
27310 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5quick.dll
27372 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5quick.dll
27435 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5quick.dll
27482 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5quick.dll
27544 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5quick.dll
27607 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5websockets.dll
27669 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5websockets.dll
27779 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5network.dll
27826 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5network.dll
27888 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5network.dll
27951 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5network.dll
28013 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\qt5network.dll
28138 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28201 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28263 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28326 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28372 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28435 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28497 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28544 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28607 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\libcrypto-1_1-x64.dll
28747 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\python\DLLs\libssl-1_1-x64.dll
28810 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\python\DLLs\libssl-1_1-x64.dll
28857 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\DLLs\libssl-1_1-x64.dll
28919 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\DLLs\libssl-1_1-x64.dll
29107 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\Qt5Qml.dll
29154 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\Qt5Qml.dll
29216 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\Qt5Qml.dll
29279 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\Qt5Qml.dll
29341 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\Qt5Qml.dll
29388 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\python\lib\site-packages\PyQt5\Qt\bin\Qt5Qml.dll
29388 INFO: Looking for eggs
29404 INFO: Using Python library c:\python\python37.dll
29404 INFO: Found binding redirects:
[]
29404 INFO: Warnings written to E:\qt\pyqt\CANdataSender\build\main\warn-main.txt
29482 INFO: Graph cross-reference written to E:\qt\pyqt\CANdataSender\build\main\xref-main.html
29529 INFO: checking PYZ
29529 INFO: Building PYZ because PYZ-00.toc is non existent
29529 INFO: Building PYZ (ZlibArchive) E:\qt\pyqt\CANdataSender\build\main\PYZ-00.pyz
30075 INFO: Building PYZ (ZlibArchive) E:\qt\pyqt\CANdataSender\build\main\PYZ-00.pyz completed successfully.
30091 INFO: checking PKG
30091 INFO: Building PKG because PKG-00.toc is non existent
30091 INFO: Building PKG (CArchive) PKG-00.pkg
31888 WARNING: One binary added with two internal names.
31888 WARNING: ('libGLESv2.dll',
 'C:\\python\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
 'BINARY')
31888 WARNING: was placed previously at
31888 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll',
 'C:\\python\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
 'BINARY')
44278 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
44293 INFO: Bootloader c:\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
44293 INFO: checking EXE
44293 INFO: Building EXE because EXE-00.toc is non existent
44293 INFO: Building EXE from EXE-00.toc
44293 INFO: Appending archive to EXE E:\qt\pyqt\CANdataSender\dist\main.exe
44512 INFO: Building EXE from EXE-00.toc completed successfully.

打包完,到 dist 文件夹里找 main.exe 打开运行,果然显示 Failed to execute script main

然后就发现 ControlCAN.dll 依赖于 Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package MFC 安全更新(至于可能遇到缺失其他的依赖库的情况,可以到这里去找:https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads

然后至于上面那些 lib not found: api-ms-win-crt-啥啥啥 的警告,原来缺失的相关库文件路径在这里:C:\Windows\System32\downlevel
解决这个问题的方法:

  1. pyinstaller -p C:\Windows\System32\downlevel xxx(xxx:你要打包的项目)
  2. 或者是直接跑到这个目录下,把里面所有的 dll 文件全复制过来

至于 Hidden import "sip" not found! 的警告,貌似这个包没啥用,可以用以下方法屏蔽掉:
pyinstaller -p C:\Windows\System32\downlevel -Fw main.py --hidden-import=PyQt5.sip

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,014评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,796评论 3 386
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 158,484评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,830评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,946评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,114评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,182评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,927评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,369评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,678评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,832评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,533评论 4 335
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,166评论 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,885评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,128评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,659评论 2 362
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,738评论 2 351

推荐阅读更多精彩内容