2012-09-20 143 views
3

爲什麼我安裝GTK & PyGTK的與自制,但蟒蛇仍無法找到它:沒有模塊名爲GTK

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 

回答

2

檢查模塊在你的Python路徑。檢查你已經安裝的軟件包的位置,並將其添加到你的bashrc中,

#.bashrc   
PATH=$PATH:$HOME/bin:/opt/lib/python2.4/site-packages/psycopg2/:path_to_module 
export PATH 
+0

你的意思是PYTHONPATH? – Alfred

2

這些庫不在PYTHONPATH中。我會嘗試:

$ export PYTHONPATH=/usr/local/lib/python2.7/site-packages 
相關問題