Python 2.7 module path problems on OS X

Nicholas Cole nicholas.cole at gmail.com
Mon Sep 6 04:29:48 EDT 2010


On Sun, Sep 5, 2010 at 8:57 PM, Ned Deily <nad at acm.org> wrote:
> In article
> <AANLkTim4fk9Y2MaBs3H14Z+5RKBxtgmP27VyvMkQEwS+ at mail.gmail.com>,
>  Nicholas Cole <nicholas.cole at gmail.com> wrote:
>
>> On Sun, Sep 5, 2010 at 10:20 AM, Ned Deily <nad at acm.org> wrote:
>> > I'm not sure why you think it is broken.  The Apple 2.6 and the
>> > python.org 2.7 have different site-package directories in different
>> > locations.  That is to be expected.  The Apple-supplied Python comes
>> > with some additional packages pre-installed, like setuptools, PyObjC,
>> > and wx.  But you would need to install new versions of these for 2.7
>> > anyway.
>> >
>> Sorry. I wasn't clear.  Of course I understand that each version of
>> python needs its own additional packages, and I was expecting to
>> re-install them.  But I don't want to install system-wide --  I'd like
>> to have my own, user-specific, site-packages.  On previous versions of
>> python, I've  installed into
>> ~/Library/Python/$py_version_short/site-packages under my home
>> directory.
>>
>> In my recollection, this has worked in the past for python installed
>> from python.org, but perhaps that recollection is wrong.  At any rate,
>> it doesn't  work with python 2.7.
>
> Ah, my apologies.  I overlooked the "~/Library" part.  So what you have
> been using is the setuptools Mac OS X "User" Installation configuration:
> (http://peak.telecommunity.com/DevCenter/EasyInstall#mac-os-x-user-instal
> lation).   Yes, it seems an incompatibility has been introduced in 2.7
> for OS X.  There has been an on-going and as yet unresolved discussion
> on the python-dev list about the topic of user directory and config file
> locations so things will likely change and get more consistent in the
> future.  But this particular problem is more immediate.  I believe the
> problem here is that the default user directory path was changed between
> 2.6 and 2.7 from:
>
>    ~/Library/Python/m.n/site-packages
>
> to
>
>    ~/Library/Python/m.n/lib/python/site-packages
>
> I will track that down further and open an issue for it, if necessary.
> In the meantime, here's a little snippet that I think should work around
> the problem for the moment without requiring a change to your
> configuration files.  (For simplicity of installation, it uses the
> Distribute fork of setuptools).  The main point is to create a symlink
> between the old and new locations. Let me know if this works for you:

Dear Ned,

Thank you very much for your help and for the code snippet.  I don't
know enough about the background to open an issue myself, so I am
grateful that you might take this on.  Just to throw in my $0.02, I do
think is important to be able to have a distutils configuration that
works across versions (since so many of us have several versions
installed for testing purposes), and so I do view this incompatibility
is a bug!

But thank you very much for solving my immediate problem.

Best wishes,

Nicholas



More information about the Python-list mailing list