2011-11-06 134 views
1

最近我將我的Ubuntu升級到版本11.10,所以我不得不重新安裝python3模塊。我下載了最新的PyQt4的,但是當我運行configure.py我收到以下錯誤:Python3.2 PyQt4安裝:UnboundLocalError

Qt Designer plugin disabled because Python library couldn't be found 
An internal error occured. Please report all the output from the program, 
including the following traceback, to [email protected] 
Traceback (most recent call last): 
    File "configure.py", line 2269, in <module> 
    main() 
    File "configure.py", line 2254, in main 
    subdirs=pyqt.qpy_libs() + pyqt_modules + xtra_modules + pyqt.tools(), 
    File "configure.py", line 957, in tools 
    link = "%s -lpython%d.%d%s" % (lib_dir_flag, py_major, py_minor, abi) 
UnboundLocalError: local variable 'lib_dir_flag' referenced before assignment 

我真的沒有一點頭緒什麼是錯的。順便說一句。在我將Ubuntu升級到11.10之前,我使用了python3.1,一切都很好。

回答

1

在嘗試構建PyQt4之前,請確保您安裝了正確的sip軟件包。對於Ubuntu,我認爲你將需要python-sip-devpython3-sip-dev包(加上任何依賴)。或者,您可以從源代碼下載並構建latest version of sip

當您運行configure.py腳本或者PyQt的或SIP,至關重要的是,你使用了正確版本的Python,e.g:

/usr/bin/python3.2 configure.py