I'm attempting to convert a .py file to a .exe file. However, I get a wei开发者_运维问答rd output.
Output:
usage: module1 [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: module1 --help [cmd1 cmd2 ...]
or: module1 --help-commands
or: module1 cmd --help
error: no commands supplied
My code:
from distutils.core import setup
import py2exe
setup(console=['newstyledemo.py'])
Also when this is done where do I recover the .exe file? I'd like to place it on a flash drive for redistribution.
I'm running Python 2.6 on Windows-7, BTW
Useing Gui2exe can be smart,i use it to both console and gui.
Here is a script i have used,and have worked ok.
from distutils.core import setup
import py2exe
import sys
if len(sys.argv) == 1:
sys.argv.append("py2exe")
setup( options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 3}},
zipfile = None,
## data_files = ['apple.jpg', 'cheese.jpg'],
#Your py-file can use windows or console
windows = [{"script": 'my.py'}])
精彩评论