【问题标题】:Why python 2.7.2 does not have a symbolic link in /usr/lib/python2.7 [closed]为什么 python 2.7.2 在 /usr/lib/python2.7 中没有符号链接 [关闭]
【发布时间】:2012-02-19 09:07:47
【问题描述】:

我破坏了 Mercurial 安装。所以我用 python-2.7.2-macosx10.6.dmg 在 64 位 Mac Os 10.6 ( Snow Leopard ) 上重新安装了 Python-2.7。 我有文件夹 /Library/Frameworks/Python.framework/Versions/2.7/ 。 Python 2.7.2 可以解释

文件夹 /usr/lib/python2.6 退出但不是 python2.7 。看来 PYTHONPATH 变量环境必须设置为 /usr/lib/python-latest-version

我也没有 /Library/Python/2.7。似乎不是一个糟糕的安装

如何正确获取 /usr/lib/python2.7 文件夹?我可以手动创建吗?

【问题讨论】:

  • 致关闭为off topic的用户。应该在哪里(在 stackexchange 网站上)问这种问题?

标签: python macos mercurial osx-snow-leopard python-2.7


【解决方案1】:

大多数 Python 框架构建在 OS X 上,尤其是像您安装的 python.org Python,不要使用 /usr/lib/python*。您可以使用 Python 标准库中的 sysconfig 模块找到标准库和 Distutils 安装的站点包的位置:

$ python2.7
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_path('stdlib')
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
>>> sysconfig.get_path('purelib')
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-28
    • 1970-01-01
    • 1970-01-01
    • 2013-07-11
    • 1970-01-01
    • 2016-06-26
    • 1970-01-01
    相关资源
    最近更新 更多