C:\Users\XXX\mysearch>pyinstaller --version
3.5
C:\Users\XXX\mysearch>python --version
Python 3.7.5rc1
C:\Users\XXX\mysearch>pip --version
pip 19.3.1 from c:\python37\lib\site-packages\pip (python 3.7)
C:\Users\XXX\mysearch>pip install wmi
Requirement already satisfied: wmi in c:\python37\lib\site-packages (1.4.9)
我能够使用'python src \ test.py'运行test.py而没有任何问题 但是,当我运行由Pyinstaller生成的exe文件时,它无法显示:
C:\Users\XXX\mysearch>dist\test\test.exe
Traceback (most recent call last):
File "test.py", line 10, in <module>
File "c:\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\wmi.py", line 88, in <module>
ModuleNotFoundError: No module named 'win32com'
[2640] Failed to execute script test
这是Pyinstaller生成的日志:
C:\Users\XXX\mysearch>pyinstaller src\test.py
107 INFO: PyInstaller: 3.5
107 INFO: Python: 3.7.5rc1
108 INFO: Platform: Windows-10-10.0.17763-SP0
115 INFO: wrote C:\Users\XXX\mysearch\test.spec
117 INFO: UPX is not available.
121 INFO: Extending PYTHONPATH with paths
['C:\\Users\\XXX\\mysearch\\src', 'C:\\Users\\XXX\\mysearch']
121 INFO: checking Analysis
307 INFO: checking PYZ
336 INFO: checking PKG
337 INFO: Building because toc changed
338 INFO: Building PKG (CArchive) PKG-00.pkg
367 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
372 INFO: Bootloader c:\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
372 INFO: checking EXE
374 INFO: Building because toc changed
375 INFO: Building EXE from EXE-00.toc
378 INFO: Appending archive to EXE C:\Users\XXX\mysearch\build\test\test.exe
418 INFO: Building EXE from EXE-00.toc completed successfully.
425 INFO: checking COLLECT
WARNING: The output directory "C:\Users\XXX\mysearch\dist\test" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
1988 INFO: Removing dir C:\Users\XXX\mysearch\dist\test
2345 INFO: Building COLLECT COLLECT-00.toc
8322 INFO: Building COLLECT COLLECT-00.toc completed successfully.