如何在Mac上更改Python的系统路径?

如何在Mac上更改Python的系统路径?,python,pythonpath,Python,Pythonpath,关于蟒蛇我有个问题 打印sys.path的内容时,系统版本显示在Macports版本之前。如何更改路径,使macports版本永久出现在系统版本之前,我不想在每个程序的开头反转路径。如果您感兴趣,这是整个路径: ['', '/Library/Python/2.7/site-packages/pyglet-1.1.4-py2.7.egg', '/Library/Python/2.7/site-packages/greenlet-0.3.1-py2.7-macosx-10.7-intel.egg',

关于蟒蛇我有个问题

打印sys.path的内容时,系统版本显示在Macports版本之前。如何更改路径,使macports版本永久出现在系统版本之前,我不想在每个程序的开头反转路径。如果您感兴趣,这是整个路径:

['', '/Library/Python/2.7/site-packages/pyglet-1.1.4-py2.7.egg', '/Library/Python/2.7/site-packages/greenlet-0.3.1-py2.7-macosx-10.7-intel.egg', '/Library/Python/2.7/site-packages/cocos2d-0.4.0-py2.7.egg', '/Library/Python/2.7/site-packages/simplejson-2.1.6-py2.7-macosx-10.7-intel.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', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyObjC', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info', '/Library/Python/2.7/site-packages']

只需执行以下操作:sys.path.appendthe new path here

这不起作用,因为当我重新启动Python时,路径与以前保持不变,除非我遗漏了一些东西…/usr/local/lib/Python/site包根据Python目录更改它,并在该目录中放置路径文件.pth。路径文件只是简单的文件,每行有一个库路径。