【发布时间】:2011-12-20 22:52:21
【问题描述】:
我正在运行 OS X Lion(在 Leopard 上启动,并经历了两次升级)。 OS X Lion 附带 Python 2.7。在某些时候,我认为 Python 和它的包可以一起工作(可能在我使用 Lion 升级之前)。
我可以以非超级用户身份运行 Python。但是,当我导入包或尝试运行 easy_install 时,例如,我收到以下错误。
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 $
当我以 root 或 sudo 运行它时,一切正常。所有目录和文件分别具有0755 或0644 权限。
对于 Python 及其在 OS X Lion 上的包应该有什么权限,以便您可以像普通用户一样使用它?我的权限当前配置的方式是默认的,还是我一路搞砸了权限。
我意识到我可以通过 /System/Library/... 和 /Library/Python/... 目录并将所有权和权限更改给我。但这似乎不是正确的解决方案。
【问题讨论】:
标签: python macos permissions osx-lion