I want to make a python package executable from the command line.
I know you can do chmod +x myfile.py
where myfile.py
starts with #!/usr/bin/env
to make a single file executable using ./myfile.py
. I also know you can do python -m mypackage
to run a package including a __main__.py
.
However, if I add the shebang line to the __main__.py
of a package, run chmod +x mypackage
, and try ./mypackage
, I get the error -bash: ./mypackage: Is a directory
.
Is it possible to run a package like this?
(To be clear, I'm not looking for something like py2exe to make it a standalone executable. I'm still expecting it to be interpreted, I just want to make the launch simpler)