Python sys.path
中出现条目的顺序是否与找到包的顺序相对应?例如,我有
>>> from pprint import pprint
>>> pprint(sys.path)
['',
'/Library/Python/2.7/site-packages/ipython-0.14.dev-py2.7.egg',
'/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/numpy-1.8.0.dev_3abd869_20121222-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/pymc-2.2-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/scikit_learn-0.13_git-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/scipy-0.12.0.dev_d631749_20121222-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/readline-6.2.4.1-py2.7-macosx-10.7-intel.egg',
'/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg',
'/Library/Python/2.7/site-packages/six-1.2.0-py2.7.egg',
'/Library/Python/2.7/site-packages/tornado-2.4.1-py2.7.egg',
'/Library/Python/2.7/site-packages/pyzmq-2.2.0.1-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/patsy-0.1.0-py2.7.egg',
'/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg',
'/Library/Python/2.7/site-packages/xattr-0.6.4-py2.7-macosx-10.8-intel.egg',
'/Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg',
'/Library/Python/2.7/site-packages/astropy-0.3.dev2837-py2.7-macosx-10.8-intel.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
'/Library/Python/2.7/site-packages']
所以,一般来说,我有
['',
'/Library/Python/2.7/site-packages/PKG_WITH_EGG.egg',
...
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
...
'/Library/Python/2.7/site-packages']
这是否意味着如果我安装的软件包(在'site-packages'中)碰巧有.egg
,它将取代可能在'Extras'中的相同软件包的版本,但那些( 'site-packages')中没有.egg
的内容将被'Extras'中的任何版本取代?