在Yosemite升级之后,Python的'site.py'消失了。可以吗? [英] Python's 'site.py' gone after Yosemite upgrade. Is that okay?

查看:573
本文介绍了在Yosemite升级之后,Python的'site.py'消失了。可以吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Yosemite(OS X 10.10)升级包括Python 2.7.6,与Apple系统更新一样,该过程似乎完全取代了系统包目录,在

The Yosemite (OS X 10.10) upgrade includes Python 2.7.6, and the process, as usual with Apple system updates, seems to completely replace the system packages directory, in

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

这次,该过程似乎完全省略了 site.py 。我的理解是这个文件对于Python的运行至关重要,特别是正确构建包搜索路径;但我的Python(它只使用Apple系统Python和 site-packages 中的其他软件包)工作正常,并且我的路径保持与升级前一样。

This time, the process appears to have entirely omitted site.py. My understanding was that this file was essential to the functioning of Python, in particular, the proper construction of package search paths; but my Python (which uses nothing more than the Apple system Python and additional packages in site-packages) works fine, and my paths remain as they were before the upgrade.

site.py 不再需要Python的正常运行?是否已将其移至其他位置?

Is site.py no longer needed for proper functioning of Python? Has it been moved to another location?

推荐答案

site.py 仍在使用。您只是找不到合适的位置:

site.py is still used. You are just not looking in the right location:

>>> import site
>>> print site.__file__
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc

/ Extras 结构似乎完全由非标准库包组成,例如Apple为自己的用途安装的软件包,这些软件包不包含在标准Python中。

The /Extras structure appears to consist entirely of non-standard-library packages, e.g. packages that Apple installs for their own uses that are not included with standard Python.

如果 网站。 py 以前的OS X版本中的文件很可能 setuptools安装的文件 ; 10.10来自 setuptools 1.1.6,它已经摆脱了该文件中包含的黑客攻击。

If there was a site.py file there in previous OS X versions it was in all likelihood one installed by setuptools; with 10.10 comes setuptools 1.1.6, which has long since got rid of the hack embodied in that file.

这篇关于在Yosemite升级之后,Python的'site.py'消失了。可以吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆