I used distutils to install my python package using this setup.py:
import distutils.core args = { 'name' : 'plugh', 'version' : '1.0', 'scripts' : [ "scripts/plugh" ], 'packages': [ "plugh" ], } d = distutils.core.setup( **args )
On linux / mac, it works as expected:
% plugh hello world %
In windows, the script "plugh" does not start:
C:\Python25\Scripts>plugh 'plugh' is not recognized as an internal or external command, operable program or batch file. C:\Python25\Scripts>
I found a bug report at http://bugs.python.org/issue7231 that the \ Scripts directory was not added to PATH when installing python, so I applied the workaround described in this ticket (i.e. add C: \ Python25 \ Scripts to PATH)
C:\Python25\Scripts>path PATH=c:\Python25\Scripts;C:\Program Files\Legato\nsr\bin;C:\WINDOWS\system32;C:\ WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;c:\python2 5;c:\local;C:\WINDOWS\system32\WindowsPowerShell\v1.0
Is this something that just doesn't work on Windows? And if so, how exactly should you use python scripts on a Windows machine?
I assume that I could detect Windows and add to the list an additional script called "plugh.bat" containing something like:
@echo off c:\python25\python.exec c:\python25\scripts\plugh %1 %2 %3 %4 %5 %6 %7 %8 %9
but is this really the right answer? I would think that with all the settings that distutils contains for windows, there would be a better answer than that.
python windows packaging distutils
Mark S.
source share