[Distutils] virtual-python.py, sys.prefix, and Mac

Philipp von Weitershausen philipp at weitershausen.de
Sat Sep 15 18:30:51 CEST 2007

On 15 Sep 2007, at 18:09 , Ian Bicking wrote:
> Hi all.  I'm kind of giving up on workingenv, and have started  
> working from virtual-python as a basis instead (http:// 
> pypi.python.org/pypi/virtualenv/).
> So the basic technique here is to copy the executable into /ENV/bin/ 
> python, and then sys.prefix will be '/ENV'.  The standard Python  
> installed on a Mac doesn't seem to do this -- the prefix remains '/ 
> opt/local/Library/Frameworks/Python.framework/Versions/2.4'  
> regardless.  (Custom built Python's on Mac work like normal.)

Since I'm the one who's experiencing this, here's some more info:

* Both the Python 2.4 from MacPorts as well as the binary MacPython  
package fail to create a virtualenv because sys.prefix of the copied  
executable still points to the old location.

* Self-compiled Python 2.4 and 2.5 doesn't have this problem, nor  
does the Python 2.5 from MacPorts or the MacPython 2.5 binary (!!!)

So this seems to be constrained to Python 2.4 from MacPorts and  

More information about the Distutils-SIG mailing list