Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I have reinstalled MacPorts Python. I have port select --set python python27 and which python returns the proper location, i.e., /opt/local/bin. Now, when I import modules in the python interpreter, though, I believe the module is looked for first in the non-MacPorts directory, i.e./Library/Python/2.7/site-packages/.

I believe this is because these of the output of print(sys.path):

['',
 '/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg',
 '/Library/Python/2.7/site-packages/DateUtils-0.5.1-py2.7.egg',
 '/Library/Python/2.7/site-packages/ipython-0.13.dev-py2.7.egg',
 '/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.7-intel.egg',
 '/Library/Python/2.7/site-packages/numpy-1.7.0.dev_3cb783e_20120427-py2.7-macosx-10.7-x86_64.egg',
 '/Library/Python/2.7/site-packages/pandas-0.7.3_20120507-py2.7-macosx-10.7-x86_64.egg',
 '/Library/Python/2.7/site-packages/pymc-2.2beta-py2.7-macosx-10.7-intel.egg',
 '/Library/Python/2.7/site-packages/scipy-0.10.1_20120427-py2.7-macosx-10.7-x86_64.egg',
 '/Library/Python/2.7/site-packages/statsmodels-0.4.0-py2.7-macosx-10.7-intel.egg',
 '/Library/Python/2.7/site-packages/readline-6.2.2-py2.7-macosx-10.7-intel.egg',
 '/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
 '/Library/Python/2.7/site-packages',
 '/Library/Python/2.7/site-packages/PIL']

My question is: are all of those /Library/Python/2.7/site-packages/.....etc. necessary? Or can I just remove them, and that way Python just looks through the /opt/ directories? Then, if it doesn't find it, it looks to those two entries tacked on at the end: /Library/Python... for other packages?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.