Running scripts without installing Python?

Gary Herron gherron at islandtraining.com
Fri Sep 17 02:33:01 EDT 2004


On Thursday 16 September 2004 12:14 pm, hepp wrote:
> Is it possible to run a Python script in Windows without installing
> Python on your machine first?

If you just pick up the whole directory structure and put it on a
machine that's never seen python, it will mostly work.  Several things
can fail, but there are work-arounds that are not too difficult:

  The module search path (stored by Python in sys.path) may not pick
  everything up.  Running python.exe from the directory it resides
  in will mostly fix this up.  Your python script may need
  to explicitly append some paths to sys.path before doing other
  imports.  (Yuck -- but not too bad.)

  Windows won't find any of the DLL's that get installed in the
  system32 directory -- the work around is to decide on the working
  directory from which your scripts will be run, and copy any needed
  DLL's into that directory.  Then windows will find them.

I've successfully done this for an application that runs on both
Windows and Linux, using PIL, numarray, PyOpenGL, GTK+, libglade, and
gtglext, as well as buchnes of standard library things.  It's not a
picnic, but it can be made to work.  Several pieces of win32all need
special care.

Gary Herron








More information about the Python-list mailing list