I am running OS X Lion (started on Leopard, and have gone through two upgrades). OS X Lion comes with Python 2.7. At some point, I thought Python and its packages were working together (possibly before my upgrade with Lion).
I can run Python as a non-superuser. However, when I import packages or try running easy_install, for example, I get the following error.
system:distutils $ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import zope
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/zope/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 698, in <module>
class Environment(object):
File "build/bdist.linux-i686/egg/pkg_resources.py", line 701, in Environment
def __init__(self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR):
File "build/bdist.linux-i686/egg/pkg_resources.py", line 96, in get_supported_platform
plat = get_build_platform(); m = macosVersionString.match(plat)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 222, in get_build_platform
plat = get_platform()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/util.py", line 165, in get_platform
"Don't know machine value for archs=%r"%(archs,))
ValueError: Don't know machine value for archs=()
>>> ^D
system:distutils $
When I run it as root or as sudo, everything works fine. All of the directories and files have 0755 or 0644 permissions, respectively.
What should the permissions be for Python and its packages on OS X Lion so you can use it as a normal user? Is the way my permissions are currently configured the default, or did I mess up the permissions along the way.
I realize I can go through the /System/Library/… and the /Library/Python/… directories and change the ownership and permission to me. But that does not seem like that is the correct solution.
After struggling for a while, and getting repeatedly frustrated, I figured out two reasons easy_install could fail with this error.
util.pyto find the line that produced the error, and changed the result.This worked perfectly. I now never receive that error. I have put the diff below for the solution. Please note, I chose
'intel'for themachinetype, because with OS X Lion, all PPC support is removed.I hope this helps someone else.