When I run a very simple py2exe test, it gives me errors

I wrote a very simple program called test.py that looks like this:

print 'hello world' 

then I wrote the setup.py installer that looks like this:

 from distutils.core import setup import py2exe setup(console=['test.py']) 

They are in the same folder, so it should work. When I run setup.py, it gives me error messages that look like this:

 C:\Python26\lib\sets.py:85: DeprecationWarning: functions overriding warnings.showwarning() must support the 'line' argument stacklevel=2) Traceback (most recent call last): File "C:\Users\python2.6\Desktop\program\pygametests\setup.py", line 5, in <module> setup(console=['test.py']) File "C:\Python26\lib\distutils\core.py", line 140, in setup raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: no commands supplied 

I am running windows vista.

+4
source share
1 answer

you should go to the folder in which you have your files and run:

 C:\Python27\mydir> python setup.py py2exe 

or directly

 C:\Python27\mydir> setup.py py2exe 

the trace tells you that you are not sending any command ("py2exe" in my example) to setup.py on the command line

You can see the available commands with:

 C:\Python27\mydir>setup.py --help-commands Standard commands: build build everything needed to install build_py "build" pure Python modules (copy to build directory) build_ext build C/C++ extensions (compile/link to build directory) build_clib build C/C++ libraries used by Python extensions build_scripts "build" scripts (copy and fixup #! line) clean clean up temporary files from 'build' command install install everything from build directory install_lib install all Python modules (extensions and pure Python) install_headers install C/C++ header files install_scripts install scripts (Python or otherwise) install_data install data files sdist create a source distribution (tarball, zip file, etc.) register register the distribution with the Python package index bdist create a built (binary) distribution bdist_dumb create a "dumb" built distribution bdist_rpm create an RPM distribution bdist_wininst create an executable installer for MS Windows upload upload binary package to PyPI check perform some checks on the package py2exe usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help C:\Python27\mydir> 
+3
source

Source: https://habr.com/ru/post/1416656/


All Articles