I\'ve got a command line program that uses Python\'s click package. I can install and run it locally, no problem with:
pip install --editable . # (or leave out t
I much prefer pyinstaller to the other alternatives, so I will cast an answer in terms of pyinstaller.
You can detect when your program has been frozen with pyinstaller, and then start the click app like:
if getattr(sys, 'frozen', False):
cli(sys.argv[1:])
This simple test app can be built simply with:
pyinstaller --onefile hello.py
import sys
import click
@click.command()
@click.argument('arg')
def cli(arg):
click.echo("I AM WORKING (%s)" % arg)
if getattr(sys, 'frozen', False):
cli(sys.argv[1:])
>dist\test.exe an_arg
I AM WORKING (an_arg)