为什么我安装gtk& pygtk与自制软件,但python仍然无法找到它:
brew test -v pygtk
Testing pygtk
==> chmod +x test.py
chmod +x test.py
==> ./test.py
./test.py
Traceback (most recent call last):
File "./test.py", line 2, in <module>
import pygtk
ImportError: No module named pygtk
Error: pygtk: failed
答案 0 :(得分:2)
检查模块是否在python路径中。检查软件包的安装位置,并在bashrc中添加它,
#.bashrc
PATH=$PATH:$HOME/bin:/opt/lib/python2.4/site-packages/psycopg2/:path_to_module
export PATH
答案 1 :(得分:2)
库不在PYTHONPATH中。我试试:
$ export PYTHONPATH=/usr/local/lib/python2.7/site-packages