[issue15048] Manually Installed Python Includes System Wide Paths

Ned Deily report at bugs.python.org
Tue Jun 12 03:50:37 CEST 2012


Ned Deily <nad at acm.org> added the comment:

I have to admit that I'm not keen on this feature for the reasons James cited.  And I think the example of the shared user site directory is not a good analogy.  In that case, you, as a user, have more control over the presence and contents of the directory since it is located within your home directory.  You would normally need administrator privilege to manipulate /Library/Python.  And, in any case, it would be better if there *were* separate user site directories per Python instance, IMO.  Yes, you can play with sys.path after the fact but that's not very friendly.  It certainly can lead to confusion.  An uncontrived example:

$ sudo easy_install-2.7 appscript
[...]
Installed /Library/Python/2.7/site-packages/appscript-1.0.0-py2.7-macosx-10.7-intel.egg
$ /usr/bin/python2.7 -c "import appscript"
$ /usr/local/bin/python2.7 -c "import appscript"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/bdist.macosx-10.7-intel/egg/appscript/__init__.py", line 8, in <module>
  File "build/bdist.macosx-10.7-intel/egg/aem/__init__.py", line 5, in <module>
  File "build/bdist.macosx-10.7-intel/egg/aem/ae.py", line 7, in <module>
  File "build/bdist.macosx-10.7-intel/egg/aem/ae.py", line 3, in __bootstrap__
ImportError: No module named pkg_resources

... because the non-system Python did not have Distribute or setuptools installed, whereas Apple supplies it with the system Python.  It's not the only package to fail in a similar way. I expect there are other cases where differences in extension module builds could cause problems.  To me, the feature seems to go against "explicit is better than implicit".

As far as I know, the only place where this behavior is documented is in the What's New documents for 2.7.  I wouldn't object to removing it in 3.3.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15048>
_______________________________________


More information about the Python-bugs-list mailing list