在不使用命令行的情况下使用Py2Exe [英] Using Py2Exe without command line

查看:123
本文介绍了在不使用命令行的情况下使用Py2Exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用py2exe编译python脚本而无需从命令行调用py2exe?

Is it possible to compile a python script with py2exe without calling py2exe from the command line?

>Python setup.py py2exe

我想从脚本中运行所有程序,但是还没有找到一种方法.

I'd like to run it all from a script, but haven't found a way to do so.

推荐答案

在setup.py的开头

at the beginig of the setup.py

import sys

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

这样,如果在不使用args或双击的情况下调用setup.py,它将开始打包

this way, if setup.py is called without args or with a double click, it will start the packaging

这篇关于在不使用命令行的情况下使用Py2Exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆