[Python-Dev] Why does Mac OS X python share site-packages with apple python?
Barry Scott
barry at barrys-emacs.org
Sun Mar 4 01:08:24 CET 2012
On 3 Mar 2012, at 21:57, Ned Deily wrote:
> In article <5A0E2490-A743-4729-A752-D94524EA9840 at barrys-emacs.org>,
> Barry Scott <barry at barrys-emacs.org> wrote:
>> On my Mac OS X 10.7.3 System I have lots of python kits installed for
>> developing extensions.
>>
>> I'll just noticed that Python.org 2.7.2 uses the sames site-packages folder
>> with Apple's
>> 2.7.1.
>>
>> Since extensions compiled against Apple's 2.7.1 segv when used by
>> python.org's 2.7.2
>> this is at least unfortunate.
>>
>> Here is the what is in sys.path for both versions. Notice
>> /Library/Python/2.7/site-packages
>> is in both.
>
> That directory is in the default sys.path for both the Apple-supplied
> Python 2.7 in Lion and for the python.org Python 2.7's but that doesn't
> mean both versions use the same site-packages directory:
>
> $ /usr/bin/python2.7 -c "import distutils.sysconfig; \
> print(distutils.sysconfig.get_python_lib())"
> /Library/Python/2.7/site-packages
>
> $ /usr/local/bin/python2.7 -c "import distutils.sysconfig; \
> print(distutils.sysconfig.get_python_lib())"
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-pack
> ages
>
> That means that, by default, packages installed by Distutils-based
> installs (setup.py, easy_install, pip, et al) will be installed to the
> corresponding directory for each version.
>
> The python.org OS X Pythons (and built-from-source framework builds) add
> the Apple-specific directory to the search path in order to allow
> sharing of installed third-party packages between the two. The feature
> was added in 2.7 and 3.1+ and tracked in Issue4865
> (http://bugs.python.org/issue4865). Please open a new issue on the
> tracker if you have examples of how this is causing problems. Thanks.
>
Yes I have a example that SEGV, pysvn details of kit location in bug report.
I take it that any .so will crash as well. Only .py can be shared.
http://bugs.python.org/issue14188
Look at the order of the sys.path the apple python site-packages
hides the python.org site-packages. If the shared folder was after
the python.org then imports could be made to work.
Barry
More information about the Python-Dev
mailing list