Skip to content Skip to sidebar Skip to footer

Install Module To Site-packages With Setuptools

I'm trying to upload a CLI to PIP that, once installed, will run when the user types myscript My folder structure is like this: lib myscript __init__.py (empty) __main__.

Solution 1:

You haven't install myscript, you've installed lib.myscript so try this: python -m lib.myscript. And for Python to recognize lib as a package create an empty file lib/__init__.py.

PS. This code:

#!/usr/bin/env bashif [[ ! $@ ]]; then
    python -m myscript -h
else
    python -m myscript $@fi

could be simplified as:

#!/usr/bin/env bashexec python -m myscript ${@:--h}

which in shell-speak means "Use $@ if not empty, else -h"

Post a Comment for "Install Module To Site-packages With Setuptools"