python打包程序为exe

版权声明:经验之谈,不知能否换包辣条,另,转载请注明出处。 https://blog.csdn.net/zhezhebie/article/details/81908033

正常安装:

pip install pyinstaller

正常更新:

pip install --upgrade pyinstaller

安装开发中的:

pip install https://github.com/pyinstaller/pyinstaller/tarball/develop

写了个python程序,想把它变成exe程序,使其可以在任何windows上运行,结果打包的时候遇到各种错误,

参考了很多文章,但还是发现打包的时候会出现dll缺失,去sf上看说是要装个2GB的文件,有的说要使用dev版本。我安装了dev版本还是不行,编译.exe文件是成功了,但是不能执行。

看到github上面有人提issue,安装scipy,然后制定链接库。我后面试一下。

pyinstaller gui.py --hidden-import scipy._lib.messagestream --paths "C:\\Program Files\\Python36\\Lib\\site-packages\\scipy\\extra-dll"

参考链接:
https://github.com/pyinstaller/pyinstaller/issues/2987
https://pyinstaller.readthedocs.io/en/v3.3.1/installation.html

仍旧遇到问题:

PS C:\Users\Administrator\Desktop\8_21> pyinstaller -F .\pptToPdf.py
333 INFO: PyInstaller: 3.4.dev0+e4ab40328
333 INFO: Python: 3.6.5
333 INFO: Platform: Windows-10-10.0.17134-SP0
333 INFO: wrote C:\Users\Administrator\Desktop\8_21\pptToPdf.spec
333 INFO: UPX is not available.
348 INFO: Extending PYTHONPATH with paths
[‘C:\Users\Administrator\Desktop\8_21’,
‘C:\Users\Administrator\Desktop\8_21’]
348 INFO: checking Analysis
348 INFO: Building Analysis because Analysis-00.toc is non existent
348 INFO: Initializing module dependency graph…
348 INFO: Initializing module graph hooks…
348 INFO: Analyzing base_library.zip …
8027 INFO: running Analysis Analysis-00.toc
8059 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\administrator\appdata\local\programs\python\python36\python.exe
8184 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python.exe
8344 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python.exe
8453 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python.exe
8610 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python.exe
8719 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python.exe
9127 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
9283 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
9405 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
9532 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
9704 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
9813 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
9938 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
10063 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
10188 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
10325 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
10437 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
10546 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\python36.dll
10781 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\VCRUNTIME140.dll
10906 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\VCRUNTIME140.dll
11031 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\VCRUNTIME140.dll
11140 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\VCRUNTIME140.dll
11265 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\VCRUNTIME140.dll
11281 INFO: Caching module hooks…
11281 INFO: Analyzing C:\Users\Administrator\Desktop\8_21\pptToPdf.py
11328 INFO: Processing pre-safe import module hook win32com
12116 INFO: Loading module hooks…
12116 INFO: Loading module hook “hook-encodings.py”…
12272 INFO: Loading module hook “hook-pydoc.py”…
12272 INFO: Loading module hook “hook-pythoncom.py”…
12646 INFO: Loading module hook “hook-pywintypes.py”…
13036 INFO: Loading module hook “hook-win32com.py”…
13302 INFO: Loading module hook “hook-xml.py”…
13831 INFO: Looking for ctypes DLLs
13831 INFO: Analyzing run-time hooks …
13847 INFO: Including run-time hook ‘pyi_rth_win32comgenpy.py’
13847 INFO: Looking for dynamic libraries
14081 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\pythoncom36.dll
14206 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\pythoncom36.dll
14333 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\pythoncom36.dll
14473 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\pythoncom36.dll
14583 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\pythoncom36.dll
14817 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python36\pywintypes36.dll
14942 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python36\pywintypes36.dll
15067 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python36\pywintypes36.dll
15239 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python36\pywintypes36.dll
15363 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python36\pywintypes36.dll
15518 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
15659 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
15768 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
15893 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16018 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16206 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16336 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16492 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16617 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16726 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_ssl.pyd
16867 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\pyexpat.pyd
16976 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\pyexpat.pyd
17101 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\pyexpat.pyd
17211 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\pyexpat.pyd
17350 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\pyexpat.pyd
17522 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
17648 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
17773 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
17882 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
18007 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
18132 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
18257 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
18399 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
18521 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_hashlib.pyd
18708 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_lzma.pyd
18818 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_lzma.pyd
18957 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_socket.pyd
19066 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_socket.pyd
19207 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_bz2.pyd
19324 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_bz2.pyd
19448 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_bz2.pyd
19589 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_bz2.pyd
19714 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs_bz2.pyd
19870 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\select.pyd
20105 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\unicodedata.pyd
20230 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\unicodedata.pyd
20340 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\DLLs\unicodedata.pyd
20481 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32_win32sysloader.pyd
20684 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32\win32api.pyd
20809 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32\win32api.pyd
20918 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32\win32api.pyd
21043 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32\win32api.pyd
21231 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\win32ui.pyd
21373 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\win32ui.pyd
21514 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\win32ui.pyd
21670 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\win32ui.pyd
21795 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\win32ui.pyd
21904 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\win32ui.pyd
22216 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32\win32trace.pyd
22327 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\win32\win32trace.pyd
22686 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
22842 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
22967 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23092 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23201 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23328 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23437 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23547 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23672 WARNING: lib not found: api-ms-win-crt-multibyte-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23828 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\Pythonwin\mfc140u.dll
23906 INFO: Looking for eggs
23906 INFO: Using Python library c:\users\administrator\appdata\local\programs\python\python36\python36.dll
23906 INFO: Found binding redirects:
[]
23937 INFO: Warnings written to C:\Users\Administrator\Desktop\8_21\build\pptToPdf\warn-pptToPdf.txt
24000 INFO: Graph cross-reference written to C:\Users\Administrator\Desktop\8_21\build\pptToPdf\xref-pptToPdf.html
24062 INFO: checking PYZ
24062 INFO: Building PYZ because PYZ-00.toc is non existent
24062 INFO: Building PYZ (ZlibArchive) C:\Users\Administrator\Desktop\8_21\build\pptToPdf\PYZ-00.pyz
24607 INFO: Building PYZ (ZlibArchive) C:\Users\Administrator\Desktop\8_21\build\pptToPdf\PYZ-00.pyz completed successfully.
24623 INFO: checking PKG
24623 INFO: Building PKG because PKG-00.toc is non existent
24623 INFO: Building PKG (CArchive) PKG-00.pkg
30069 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
30084 INFO: Bootloader c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
30084 INFO: checking EXE
30084 INFO: Building EXE because EXE-00.toc is non existent
30084 INFO: Building EXE from EXE-00.toc
30084 INFO: Appending archive to EXE C:\Users\Administrator\Desktop\8_21\dist\pptToPdf.exe
30583 INFO: Building EXE from EXE-00.toc completed successfully.

猜你喜欢

转载自blog.csdn.net/zhezhebie/article/details/81908033
今日推荐