安装MacPorts后,让PATH适合python
我无法导入我刚刚安装MacPorts的一些python库(PIL,psycopg2)。我浏览了这些论坛,并试图调整我的 PATH 变量 ~/.bash_profile 为了解决这个问题但它不起作用。 我添加了PIL和psycopg2的位置 PATH。 我知道终端正在使用python的一个版本 /usr/local/bin 而不是MacPorts安装的那个 /opt/local/bin。 我是否需要使用MacPorts版本的Python以确保在终端中使用python时PIL和psycopg2在sys.path上? 我应该切换到MacPorts版本的Python,还是会导致更多问题? 如果它有用,这里有更多的事实: 安装了PIl和psycopg2 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages which python 回报 /usr/bin/python $ echo $PATH 返回(我将每个路径分开以便于阅读): :/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ :/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages :/opt/local/bin :/opt/local/sbin :/usr/local/git/bin :/usr/bin :/bin :/usr/sbin :/sbin :/usr/local/bin :/usr/local/git/bin :/usr/X11/bin :/opt/local/bin 在python中, >>> sys.path 收益: /Library/Frameworks/SQLite3.framework/Versions/3/Python /Library/Python/2.6/site-packages/numpy-override /Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages /Library/Frameworks/cairo.framework/Versions/1/Python /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages …