簡體   English   中英

在 Windows 10 中使用 pyinstaller 創建的 exe 文件在 Windows 8 中無法運行

[英]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 更新包,這些包可能安裝在目標系統中,也可能未安裝。 因此,您有以下選擇:

  1. 在已報告工作的 Windows 7 上構建。

  2. 將 VCRedist 包之一(可再發行包文件)包含到應用程序的安裝程序中。 這是微軟推薦的方式。

  3. 安裝適用於 Windows 10 的 Windows 軟件開發工具包 (SDK) 並展開 .spec 文件以包含所需的 DLL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM