PyInstaller编译的exe无法从p appdata/local/temp加载未知的dll

2024-09-29 23:29:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试运行我用PyInstaller编译的exe。我正在使用PyInstaller和Python的最新版本。每当我尝试运行PyInstaller编译的exe时,无论Py文件的内容是什么,问题都会发生。 我提供的日志来自一个测试脚本,其中只有一个“helloworld”语句。你知道吗

以下是编译日志:

C:\Users\mroma\Desktop\Coding>pyinstaller --onefile --clean --debug all tester.py
46 INFO: PyInstaller: 3.5
46 INFO: Python: 3.7.3
46 INFO: Platform: Windows-10-10.0.17763-SP0
46 INFO: wrote C:\Users\mroma\Desktop\Coding\tester.spec
46 INFO: UPX is not available.
46 INFO: Removing temporary files and cleaning cache in C:\Users\mroma\AppData\Roaming\pyinstaller
70 INFO: Extending PYTHONPATH with paths
['C:\\Users\\mroma\\Desktop\\Coding', 'C:\\Users\\mroma\\Desktop\\Coding']
70 INFO: checking Analysis
70 INFO: Building Analysis because Analysis-00.toc is non existent
70 INFO: Initializing module dependency graph...
70 INFO: Initializing module graph hooks...
70 INFO: Analyzing base_library.zip ...
2571 INFO: running Analysis Analysis-00.toc
2587 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\mroma\appdata\local\programs\python\python37\python.exe
2843 INFO: Caching module hooks...
2850 INFO: Analyzing C:\Users\mroma\Desktop\Coding\tester.py
2852 INFO: Loading module hooks...
2852 INFO: Loading module hook "hook-encodings.py"...
2930 INFO: Loading module hook "hook-pydoc.py"...
2930 INFO: Loading module hook "hook-xml.py"...
3119 INFO: Looking for ctypes DLLs
3119 INFO: Analyzing run-time hooks ...
3134 INFO: Looking for dynamic libraries
3228 INFO: Looking for eggs
3228 INFO: Using Python library c:\users\mroma\appdata\local\programs\python\python37\python37.dll
3228 INFO: Found binding redirects:
[]
3290 INFO: Warnings written to C:\Users\mroma\Desktop\Coding\build\tester\warn-tester.txt
3322 INFO: Graph cross-reference written to C:\Users\mroma\Desktop\Coding\build\tester\xref-tester.html
3353 INFO: checking PYZ
3353 INFO: Building PYZ because PYZ-00.toc is non existent
3353 INFO: Building PYZ (ZlibArchive) C:\Users\mroma\Desktop\Coding\build\tester\PYZ-00.pyz
3353 INFO: Building PYZ (ZlibArchive) C:\Users\mroma\Desktop\Coding\build\tester\PYZ-00.pyz completed successfully.
3369 INFO: checking PKG
3369 INFO: Building PKG because PKG-00.toc is non existent
3369 INFO: Building PKG (CArchive) PKG-00.pkg
5564 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
5580 INFO: Bootloader c:\users\mroma\appdata\local\programs\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run_d.exe
5580 INFO: checking EXE
5580 INFO: Building EXE because EXE-00.toc is non existent
5580 INFO: Building EXE from EXE-00.toc
5580 INFO: Appending archive to EXE C:\Users\mroma\Desktop\Coding\dist\tester.exe
5658 INFO: Building EXE from EXE-00.toc completed successfully.

下面是我尝试运行编译的exe时发生的情况:

PS C:\Users\mroma\Desktop\Coding\dist> ./tester.exe
[9388] PyInstaller Bootloader 3.x
[9388] LOADER: executable is C:\Users\mroma\Desktop\Coding\dist\tester.exe
[9388] LOADER: homepath is C:\Users\mroma\Desktop\Coding\dist
[9388] LOADER: _MEIPASS2 is NULL
[9388] LOADER: archivename is C:\Users\mroma\Desktop\Coding\dist\tester.exe
[9388] LOADER: Extracting binaries
[9388] LOADER: Executing self as child
[9388] LOADER: set _MEIPASS2 to C:\Users\mroma\AppData\Local\Temp\_MEI93882
[9388] LOADER: Setting up to run child
[9388] LOADER: Creating child process
[9388] LOADER: Waiting for child process to finish...
[4560] PyInstaller Bootloader 3.x
[4560] LOADER: executable is C:\Users\mroma\Desktop\Coding\dist\tester.exe
[4560] LOADER: homepath is C:\Users\mroma\Desktop\Coding\dist
[4560] LOADER: _MEIPASS2 is C:\Users\mroma\AppData\Local\Temp\_MEI93882
[4560] LOADER: archivename is C:\Users\mroma\Desktop\Coding\dist\tester.exe
[4560] LOADER: SetDllDirectory(C:\Users\mroma\AppData\Local\Temp\_MEI93882)
[4560] LOADER: Already in the child - running user's code.
[4560] LOADER: manifestpath: C:\Users\mroma\AppData\Local\Temp\_MEI93882\tester.exe.manifest
[4560] LOADER: Activation context created
[4560] LOADER: Activation context activated
[4560] LOADER: Python library: C:\Users\mroma\AppData\Local\Temp\_MEI93882\
Error loading Python DLL 'C:\Users\mroma\AppData\Local\Temp\_MEI93882\'.
LoadLibrary: Impossibile trovare il modulo specificato.
[9388] LOADER: Back to parent (RC: -1)
[9388] LOADER: Doing cleanup
[9388] LOADER: Freeing archive status for C:\Users\mroma\Desktop\Coding\dist\tester.exe

请帮我解决这个问题。你知道吗

我该怎么做才能使PyInstaller再次工作?你知道吗


Tags: toinfoisdistloaderexeusersappdata

热门问题