我正在尝试将python脚本打包到exe中。 python脚本本身就可以正常运行,但是我没有运气使用py2exe或pyinstaller。两个程序都完成并给我一个.exe,但它没有成功执行程序,它只是提取一个命令提示太快,而不是GUI。我一直在谷歌上搜索和搔痒几个星期,我很难过。 Py2exe完成了关于二进制依赖的可怕警告:
***binary dependencie ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.
fftpack_lite.pyd - C:\Users\user\Desktop\Python\lib\site-packages\num
fftpack_lite.pyd
OLEAUT32.dll - C:\Windows\system32\OLEAUT32.dll
USER32.dll - C:\Windows\system32\USER32.dll
IMM32.dll - C:\Windows\system32\IMM32.dll
SHELL32.dll - C:\Windows\system32\SHELL32.dll
ole32.dll - C:\Windows\system32\ole32.dll
RPCRT4.dll - C:\Windows\system32\RPCRT4.dll
COMDLG32.dll - C:\Windows\system32\COMDLG32.dll
ADVAPI32.dll - C:\Windows\system32\ADVAPI32.dll
msvcrt.dll - C:\Windows\system32\msvcrt.dll
WS2_32.dll - C:\Windows\system32\WS2_32.dll
WINSPOOL.DRV - C:\Windows\system32\WINSPOOL.DRV
GDI32.dll - C:\Windows\system32\GDI32.dll
VERSION.dll - C:\Windows\system32\VERSION.dll
KERNEL32.dll - C:\Windows\system32\KERNEL32.dll
mfc90.dll - C:\Users\user\Desktop\Python\lib\site-packages\Pythonwin\ll
COMCTL32.dll - C:\Windows\system32\COMCTL32.dll
SETUPAPI.dll - C:\Windows\system32\SETUPAPI.dll
KERNELBASE.dll - C:\Windows\system32\KERNELBASE.dll
ntdll.dll - C:\Windows\system32\ntdll.dll*
假设如果我将这些文件复制到dist文件夹,.exe将正常运行是否安全?如果我打算分发包裹,我可以合法地这样做吗?为什么Pyinstaller给我一个类似的最终结果? Pyinstaller输出:
C:\Users\user\Desktop\pyinstaller-2.0>python pyinstaller.py exe.py
13 INFO: wrote C:\Users\user\Desktop\pyinstaller-2.0\exe\exe.spec 26 INFO: Testing for
ability to set icons, version resources... 52 INFO: ... resource update available 55
INFO: UPX is not available. 1003 WARNING: library python%s%s required via ctypes not
found 1046 INFO: checking Analysis 1046 INFO: building Analysis because out00-
Analysis.toc non existent 1046 INFO: running Analysis out00-Analysis.toc 1046 INFO:
Adding Microsoft.VC90.CRT to dependent assemblies of final executable
1091 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21
022.8_none ... 1092 INFO: Found manifest C:\Windows\WinSxS\Manifests
\x86_microsoft.vc90.crt_1fc 8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest
1092 INFO: Searching for file msvcr90.dll 1093 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll 1093 INFO: Searching for file
msvcp90.dll 1093 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcp90.dll 1093 INFO: Searching for file
msvcm90.dll 1093 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcm90.dll 1154 INFO: Analyzing C:\Users
\user\Desktop\pyinstaller-2.0\support\_pyi_bootstr ap.py 2126 WARNING: library
python%s%s required via ctypes not found 2154 INFO: Analyzing C:\Users\user\Desktop
\pyinstaller-2.0\PyInstaller?\loader\a rchive.py 2253 INFO: Analyzing C:\Users
\user\Desktop\pyinstaller-2.0\PyInstaller?\loader\c archive.py 2351 INFO: Analyzing
C:\Users\user\Desktop\pyinstaller-2.0\PyInstaller?\loader\i u.py 2368 INFO: Analyzing
exe.py 2503 INFO: checking Tree 2504 INFO: building because out00-Tree.toc missing or
bad 2504 INFO: building Tree out00-Tree.toc 2632 INFO: checking Tree 2632 INFO:
building because out01-Tree.toc missing or bad 2632 INFO: building Tree out01-Tree.toc
4046 WARNING: pythoncom is changing its name to pythoncom27 4060 WARNING: pywintypes
is changing its name to pywintypes27 5055 INFO: Hidden import 'encodings' has been
found otherwise 5055 INFO: Looking for run-time hooks 5056 INFO: Analyzing rthook
C:\Users\user\Desktop\pyinstaller-2.0\support/rthoo ks/pyi_rth_Image.py 5065 INFO:
Analyzing rthook C:\Users\user\Desktop\pyinstaller-2.0\support/rthoo
ks/pyi_rth_PIL_Image.py 5072 INFO: Analyzing rthook C:\Users\user\Desktop\pyinstaller-
2.0\support/rthoo ks/pyi_rth_Tkinter.py 5155 INFO: Analyzing rthook C:\Users
\user\Desktop\pyinstaller-2.0\support/rthoo ks/pyi_rth_encodings.py 5237 INFO:
Analyzing rthook C:\Users\user\Desktop\pyinstaller-2.0\support/rthoo
ks/pyi_rth_versioneddll.py 5328 INFO: Analyzing rthook C:\Users\user\Desktop
\pyinstaller-2.0\support/rthoo ks/pyi_rth_win32comgenpy.py 5424 INFO: Analyzing rthook
C:\Users\user\Desktop\pyinstaller-2.0\support/rthoo ks/pyi_rth_versioneddll.py 6231
INFO: Adding Microsoft.VC90.MFC to dependent assemblies of final executable
6274 INFO: Searching for assembly x86_Microsoft.VC90.MFC_1fc8b3b9a1e18e3b_9.0.21
022.8_none ... 6274 INFO: Found manifest C:\Windows\WinSxS\Manifests
\x86_microsoft.vc90.mfc_1fc 8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86.manifest
6276 INFO: Searching for file mfc90.dll 6276 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_ 9.0.21022.8_none_b81d038aaf540e86\mfc90.dll
6276 INFO: Searching for file mfc90u.dll 6277 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_ 9.0.21022.8_none_b81d038aaf540e86\mfc90u.dll
6277 INFO: Searching for file mfcm90.dll 6277 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_ 9.0.21022.8_none_b81d038aaf540e86\mfcm90.dll
6277 INFO: Searching for file mfcm90u.dll 6279 INFO: Found file C:\Windows\WinSxS
\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_
9.0.21022.8_none_b81d038aaf540e86\mfcm90u.dll 6910 INFO: Adding
Microsoft.Windows.Common-Controls to dependent assemblies of f inal executable 7081
INFO: Warnings written to C:\Users\user\Desktop\pyinstaller-2.0\exe\build\
pyi.win32\exe\warnexe.txt 7092 INFO: checking PYZ 7092 INFO: rebuilding out00-PYZ.toc
because out00-PYZ.pyz is missing 7092 INFO: building PYZ out00-PYZ.toc 9139 INFO:
checking PKG 9139 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing 9141
INFO: building PKG out00-PKG.pkg 9151 INFO: checking EXE 9151 INFO: rebuilding out00-
EXE.toc because exe.exe missing 9151 INFO: building EXE from out00-EXE.toc 9152 INFO:
Appending archive to EXE C:\Users\user\Desktop\pyinstaller-2.0\exe\b uild\pyi.win32
\exe\exe.exe 9184 INFO: checking COLLECT 9184 INFO: building COLLECT out00-
COLLECT.toc*
感谢您的任何指导或建议!
答案 0 :(得分:1)
试用pyinstaller的开发版。
答案 1 :(得分:0)
长话短说cxFreeze适用于你不尝试打包的时候!