Is the order reported by "sys.path" the search order for packages?

Does the order in which the entries in Python sys.path

match the order in which the packages are found? For example, I have

>>> 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']

      

so, in general, I have

['',
 '/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']

      

Does this mean that if the package I am installing (in "site-packages") has .egg

, it will replace the version of the same package that may be in "Extra", but those site-packages') that do not have .egg

, will be replaced by any version in 'Extras'?

+3


source to share





All Articles