2017-03-07 126 views
1

我試圖在Mac OSX 10.9.5的計算機上用Glade UI運行我的Python3程序。如何在osx上運行Python GTK +?

$ python3 gedder.py 
Traceback (most recent call last): 
    File "gedder.py", line 7, in <module> 
    import gi 
ImportError: No module named 'gi' 

我想從蘋果安裝Xcode_6.2.dmg時應該已經得到了GTK +和通https://wiki.gnome.org/Projects/GTK+/OSX/Building工作。

但是我怎麼能得到正確的gi庫?當與pip3一起安裝時,它給出了相當矛盾的結果。圖書館有在Python 3.5庫,但顯然它有Python2代碼:

$ pip3 install gi 
Collecting gi 
    Using cached gi-1.2.tar.gz 
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from gi) 
Installing collected packages: gi 
    Running setup.py install for gi ... done 
Successfully installed gi-1.2 

$ python3 gedder.py 
Traceback (most recent call last): 
    File "gedder.py", line 7, in <module> 
    import gi 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/gi/__init__.py", line 39 
    print url 
      ^
SyntaxError: Missing parentheses in call to 'print' 

程序在我的Ubuntu 16.4 Linux系統創建格萊德3.18.3和pip3 freeze列表中有pygobject==3.20

回答

0

我無法立即回答您的整個問題,但我注意到您可能有與運行Python 3相關的錯誤,而不是用於Python 2中的代碼。該語法錯誤通常與運行Python 2代碼(它不需要那些括號)在Python 3解釋器中。

乾杯, -T