position independent build of python

Diez B. Roggisch deets at web.de
Fri Dec 3 11:05:20 EST 2010


erikj <tw55413 at gmail.com> writes:

> If my understanding is correct, the sys.prefix variable holds the root
> directory python uses to find related files, and eg its site-packages.
>
> the value of sys.prefix is specified at compile time.
>
> it seems that on windows, when I build/install python at one location,
> and
> later move it to another location, python will find all its needs
> relative to the new location.
>
> however, when I do the same on linux, python keeps looking for
> its dependencies in the build location.
>
> is there a possibility to have it always look at a position relative
> to the location of the executable ?  the goal is to be able to build
> python on one machine, and then simply copy the build tree to
> other machines at other locations.

Maybe looking at virtualenv, especially with the --no-site-packages
variable set gives you a hint. AFAIK there are some hard-coded paths
involved, but not inside compiled code. Maybe you can remedy that somehow.

Diez



More information about the Python-list mailing list