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_冻结msi添加到路径_Python_Python 3.x_Path_Cx Freeze - Fatal编程技术网

Python 将cx_冻结msi添加到路径

Python 将cx_冻结msi添加到路径,python,python-3.x,path,cx-freeze,Python,Python 3.x,Path,Cx Freeze,我有一个微星和安装时,我希望它添加到路径的exe 我发现: 添加到路径将目标目录添加到路径环境变量;如果存在任何基于控制台的可执行文件,则默认值为True,否则为False 从 我已尝试将此添加到安装脚本: setup( name = "cabbage", version = "0.1", description = "just a vegetable", add_to_path = True, # <-- Just here

我有一个微星和安装时,我希望它添加到路径的exe

我发现:

添加到路径将目标目录添加到路径环境变量;如果存在任何基于控制台的可执行文件,则默认值为True,否则为False

我已尝试将此添加到安装脚本:

setup(  name = "cabbage",
        version = "0.1",
        description = "just a vegetable",
        add_to_path = True, # <-- Just here
        options = {"build_exe": build_exe_options},
        executables = [Executable("spam.py", base=base)])

如何添加此选项?

在setup.py脚本中添加以下行以使其正常工作

  if 'bdist_msi' in sys.argv:

        sys.argv += ['--add-to-path', 'True']
您的代码应该如下所示:

 if 'bdist_msi' in sys.argv:

        sys.argv += ['--add-to-path', 'True']


 setup(  name = "cabbage",
    version = "0.1",
    description = "just a vegetable",
    add_to_path = True, # <-- Just here
    options = {"build_exe": build_exe_options},
    executables = [Executable("spam.py", base=base)])

Run命令:python setup.py bdist_msi

你的python版本、cx_freeze版本和PATH变量是什么?@Bachrc x32位python 3.7.0和cx_freeze 5.1.1同样,我对PATH变量感到困惑,你到底是什么意思?msi中exe I包的路径?如果是,C:\TestProgram\bin@Bachrc
 if 'bdist_msi' in sys.argv:

        sys.argv += ['--add-to-path', 'True']


 setup(  name = "cabbage",
    version = "0.1",
    description = "just a vegetable",
    add_to_path = True, # <-- Just here
    options = {"build_exe": build_exe_options},
    executables = [Executable("spam.py", base=base)])