Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我在使用cx\U冻结时遇到问题_Python_Python 3.x_Python 3.3_Cx Freeze - Fatal编程技术网

Python 我在使用cx\U冻结时遇到问题

Python 我在使用cx\U冻结时遇到问题,python,python-3.x,python-3.3,cx-freeze,Python,Python 3.x,Python 3.3,Cx Freeze,首先,技术人员: Python:3.3 cx_冻结:4.3.2 我已经看了好几个设置,但一无所获。到目前为止,我只得到了一个非常快速关闭的Python命令行,并且叹了口气,没有exe。 setup.py文件: from cx_Freeze import setup, Executable executables = [ Executable("Swiss Rounds.py", appendScriptToExe=True, appendScriptToLibrary=Fals

首先,技术人员: Python:3.3 cx_冻结:4.3.2 我已经看了好几个设置,但一无所获。到目前为止,我只得到了一个非常快速关闭的Python命令行,并且叹了口气,没有exe。 setup.py文件:

from cx_Freeze import setup, Executable

executables = [
        Executable("Swiss Rounds.py", appendScriptToExe=True, appendScriptToLibrary=False)
]

buildOptions = dict(
        create_shared_zip = False)

setup(
        name = "hello",
        version = "0.1",
        description = "the typical 'Hello, world!' script",
        options = dict(build_exe = buildOptions),
        executables = executables)

谢谢大家

看起来您忘记了可执行文件的基础,因此cx freeze不知道如何生成可执行文件。这就是我构建setup.py文件的方式。如果exe是32位的,此安装程序将把它放在不同的文件夹中

import os, sys, platform
from cx_Freeze import setup, Executable

targetDir = "./build/"
build_exe_options = {
     "icon": "/assets/images/icon.ico",
     "build_exe": "/build/",
     "packages": [], 
     "includes": ["re", "os", "atexit"],
     "include_files": ["/assets/"],
     "excludes": ["tkinter", "ttk", "socket", "doctest", "pdb", "unittest", "difflib", 
                  "_bz2", "_hashlib", "_lzma", "_socket"],
     "optimize": True,
     "compressed": True,
    }

is32bit = platform.architecture()[0] == '32bit'
if is32bit:
    targetDir = "./buildX86/"
    build_exe_options["build_exe"] = targetDir
# end

base = None
if sys.platform == "win32":
    base = "Win32GUI"
# end

setup(  name = "MyProgram",
        version = "0.1",
        description = "My program example",
        options = {"build_exe": build_exe_options},
        executables = [ Executable("/myprogram.py", 
                                   targetName="MyProgram.exe",
                                   targetDir=targetDir,
                                   base=base) ]
      )
运行:


你所说的“非常快结束的视频”是什么意思?你在哪个平台上运行这个?您试图用什么命令运行此脚本?输出是什么?很抱歉,应该改为编写Python命令行。正在考虑查找视频您还没有告诉我们运行脚本的确切步骤。请在命令提示符下运行exe,查看它运行时发生的情况-如果双击它,Windows会在程序退出后立即关闭命令行。如果不使用base,则默认为
控制台
base。这可能会给你提问者看到的“快速关闭命令行”。
python setup.py build