![](/img/trans.png)
[英]My .exe file created with pyinstaller works on Windows 10, but not on windows 7
[英]exe file created using pyinstaller in windows 10 does not run in windows 8
不幸的是,當我在 Windows 10 中創建一個 exe 文件時,它永遠不會在 Windows 8 中運行。 Pyinstaller 在使用“pyinstaller.exe --onefile myfile.py”在 cmd 中運行后在我的 Windows 10 中運行的 dist 文件夾中為我提供了一個成功的 exe 文件成功但從未在 Windows 8 等早期版本中運行。
問題很可能是您在不會運行可執行文件的機器上缺少 DLL。
這是因為在某些地方,有時您已經安裝了 .NET 環境、Visual Runtime 環境或包含一組特定 DLL 的運行時,以便應用程序運行。
您可以使用--add-data
參數來添加 DLL。
pyinstaller
文檔中有關於針對舊版本 Windows 的說明:
對於面向 Windows < 10 的 Python >= 3.5,開發人員需要特別注意包含 Visual C++ 運行時 .dll:Python 3.5 使用 Visual Studio 2015 運行時,它已重命名為“Universal CRT”並已成為Windows 10 的一部分。對於從 Windows Vista 到 Windows 8.1 的 Windows 更新包,這些包可能安裝在目標系統中,也可能未安裝。 因此,您有以下選擇:
在已報告工作的 Windows 7 上構建。
將 VCRedist 包之一(可再發行包文件)包含到應用程序的安裝程序中。 這是微軟推薦的方式。
安裝適用於 Windows 10 的 Windows 軟件開發工具包 (SDK) 並展開 .spec 文件以包含所需的 DLL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.