Python's 'site.py' gone after Yosemite upgrade. Is that okay?

时光毁灭记忆、已成空白 提交于 2019-12-04 18:13:42
Martijn Pieters

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

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.

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.

If the behaviour of python hasn't changed and sys.path contains the path to your site-packages folder, you should be fine. If you use the interpreters -S option, the path to the site-packages folder won't show up in sys.path, so you can test it. I would recommend searching for the file on your system. If it doesn't show up, make sure you can see hidden files in case it's hidden for some reason.

site.py docs

edit: Resolved in comments, but wanted to provide an official answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!