在尝试编写今天使用PIL的Python脚本的过程中,我发现我似乎没有在我的本地计算机上使用它(OS X 10.5.8,默认2.5 Python安装)。
所以我跑:
easy_install --prefix=/usr/local/python/ pil
它有点抱怨/usr/local/python/lib/python2.5/site-packages尚未存在,所以我创建它,然后再试一次,得到这个:
TEST FAILED:
/usr/local/python//lib/python2.5/site-packages
does NOT support .pth files error: bad
install directory or PYTHONPATH
You are attempting to install a
package to a directory that is not on
PYTHONPATH and which Python does not
read".pth" files from. The
installation directory you specified
(via --install-dir, --prefix, or the
distutils default setting) was:
/usr/local/python//lib/python2.5/site-packages
and your PYTHONPATH environment
variable currently contains:
''
好吧,公平 - 我没有做任何事情来设定路径。所以我给?/ .bash_profile添加了一个快速行:
PYTHONPATH="$PYTHONPATH:/usr/local/python/lib/python2.5"
和source它??,然后再试一次。
相同的错误消息。
考虑到PYTHONPATH显然是固定的,这有点好奇;我可以echo $PYTHONPATH并返回:/usr/local/python/lib/python2.5。我决定从里面查看包含路径的样子:
import sys
print"
".join(sys.path)
产量:
/System/L