[distutils] Install script under a different name

Lie Ryan lie.1296 at gmail.com
Fri Dec 4 20:52:21 EST 2009


On 12/5/2009 11:34 AM, Nikolaus Rath wrote:
> Hello,
>
> All my Python files have extension .py. However, I would like to install
> scripts that are meant to be called by the user without the suffix, i.e.
> the file scripts/doit.py should end up as /usr/bin/doit.
>
> Apparently the scripts= option of the setup() function does not support
> this directly. Is there a clever way to get what I want?

if this is on windows, you should add ".py" to the PATHEXT environment 
variable.

on linux/unix, you need to add the proper #! line to the top of any 
executable scripts and of course set the executable bit permission 
(chmod +x scriptname). In linux/unix there is no need to have the .py 
extension for a file to be recognized as python script (i.e. just remove 
it).



More information about the Python-list mailing list