我对 OS X 上的 Python 使用“Extras”和“site-packages”中的包的方式感到困惑。特别是,我对在这些目录中看到的内容、目录中的重复包如何相互影响以及应该将安装的包放在哪里感到困惑。
I had assumed that 'Extras'1 was the location for packages that are not part of core Python, but that were nonetheless distributed with a given platform. For example, OS X, is distributed with PyObjC
, twisted
, and numpy
, among others; and these are found in 'Extras'. I had also assumed that 'site-packages'2 is where packages that I subsequently install go, and that the directory is empty or absent on a "fresh" machine. Furthermore I'd assumed that installing a new package would leave the version in 'Extras' alone, and place any updates I do in 'site-packages', where they would "mask" those in 'Extras'. (So for example, the default installation could simply be restored by deleting 'site-packages'.)
让我困惑的是我的“Extras”目录的内容正在减少。与新安装的 OS X (10.8.2) 上的内容相比,我当前配置的“附加”缺失
altgraph
altgraph-0.9-py2.7.egg-info
dateutil
macholib
macholib-1.4.2-py2.7.egg-info
modulegraph
modulegraph-0.9.1-py2.7.egg-info
numpy #though numpy-1.6.1-py2.7.egg-info is there
pkg_resources.py # though .pyc is there
py2app
py2app-0.6.3-py2.7.egg-info
setuptools # though setuptools-0.6c12dev_r88846-py2.7.egg-info is there
site.py # though .pyc and .pyo are there
xattr
xattr-0.6.2-py2.7.egg-info
zope
zope.interface-3.5.1-py2.7.egg-info
并且有两个在全新安装中未找到的附加文件
pkg_resources.py.OLD.1356069438.31
setuptools-0.6c12dev_r88846-py2.7.egg-info.OLD.1356069438.31
setuptools.OLD.1356069438.31
据我所知,这些都是我自己更新的软件包,所有版本都存在于“site-packages”中。
“Extras”目录的内容是否应该以这种方式“缩小”?更新“Extras”中的软件包是否会将其“移动”到“site-packages”,还是应该将“Extras”版本单独保留并简单地被“site-packages”中的版本“掩盖”?
1:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
2: /Library/Python/2.7/site-packages/