I have a python script, myscript.py, which I wish to install using distutils:
from distutils.core import setup
setup(..., scripts=['myscript.py'], ...)
I'd prefer if I could call the installed script using just myscript
instead of typing myscript.py
. This could be accomplished by renaming the file to just myscript
but then a lot of editors etc. would no longer understand that it is a Python file.
Is there some way to keep the old name, myscript.py
but still install the file as myscript
?
You could always do something like this (in
setup.py
):You might want to look at the setuptools that do this automatically for you; from http://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation :
This is the cleanest solution I have found so far. MFrecks answer causes problems, when creating a source distribution or executing a command other than installing.