我正在尝试在我的 Windows 10 机器上执行 PyInstaller main.py,我收到以下警告:
3536 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python.exe
3701 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python.exe
3921 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python.exe
4088 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python.exe
4258 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python.exe
4490 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\VCRUNTIME140.dll
4665 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\VCRUNTIME140.dll
4858 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\VCRUNTIME140.dll
5024 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\VCRUNTIME140.dll
5248 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\VCRUNTIME140.dll
5567 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
5727 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
5942 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
6108 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
6275 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
6436 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
6593 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
6752 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
6922 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
7090 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
7249 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
7417 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\dlee\appdata\local\programs\python\python36\python36.dll
我在以下目录中找到了我的 DLL:
C:\Program Files (x86)\Microsoft Visual Studio\Installer
我阅读了以下文章(https://pyinstaller.readthedocs.io/en/stable/usage.html#windows)并尝试创建一个 .spec 文件pyi-makespec main.py
来包含我的 dll。下面是我的规范文件的样子:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['C:\\Users\\dlee\\eclipse-workspace\\python_java_pyjnius_test'],
binaries=[('C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer','.')],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='main')
但是,它给了我同样的错误。
我还尝试了以下命令:
pyinstaller --add-binary "C:\Program Files (x86)\Microsoft Visual Studio\Installer;." main.py
它仍然不起作用。最后,在我执行 main.exe 后,我总是得到以下输出:
Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries
我真的很挣扎,真的不确定我做错了什么。任何帮助将不胜感激。谢谢!
最好的问候,丹尼尔·李