首页 > 解决方案 > cx_freeze Winerror 2 系统找不到指定的文件

问题描述

嗨,我正在运行 Windows 10 64 位。我正在尝试从 python 文件创建一个可执行文件。我为此使用 cx_freeze,但出现错误。这是我使用的代码

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
   base = "Win32GUI"

setup(  name = "My program",
    version = "1.0.0",
    description = "My program",
    options = {"build_exe": build_exe_options},
    executables = [Executable(Main.py", base=base, icon="Video Cut V1.0.0.ico")])

这是我得到的错误。

running build
running build_exe
creating directory build\exe.win-amd64-3.8
copying 
C:\Users\.3.8_a8p0\site-packages\cx_Freeze\bases\Win32GUI.exe -> \exe.win-amd64-3.8\Main.exe
copying C:\Program 
Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\python38.dll -> build\exe.win-amd64-3.8\python38.dll
error: [WinError 2] Het systeem kan het opgegeven bestand niet vinden: 'build\\exe.win-amd64-3.8\\Video Cut.exe'

标签: pythonexeexecutablecx-freeze

解决方案


推荐阅读