2011-12-21 93 views
1
>>> from PyQt4.QtCore import * 
Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: No module named PyQt4.QtCore 

我一直在試圖安裝PyQt4.QtWebKit,但遇到了問題。我跟着這些instructions安裝PyQt4在Ubuntu 11.04和Python 2.7+錯誤

我可以安裝(./configure,make,make install)SIP。我無法在PyQt中做到這一點。

錯誤是:

[email protected]:~/Desktop/build/PyQt$ sudo python configure.py --verbose -q  /usr/bin/qmake 
Determining the layout of your Qt installation... 
/usr/bin/qmake -o qtdirs.mk qtdirs.pro 
make -f qtdirs.mk 
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -o qtdirs.o qtdirs.cpp 
qtdirs.cpp:1:28: fatal error: QCoreApplication: No such file or directory 
compilation terminated. 
make: *** [qtdirs.o] Error 1 
Error: Failed to determine the layout of your Qt installation. Try again using 
the --verbose flag to see more detail about the problem. 
[email protected]:~/Desktop/build/PyQt$ 

可否請你建議安裝PyQt4的成功在Ubuntu軟件包詳細信息(11.04)和Python 2.7+的解決方案?

+0

我很好奇爲什麼在使用apt-get python-qt4之後,額外的手動安裝pyqt是necc。這不是與pyqt一起安裝qt4嗎?你是否試圖安裝它不是Ubuntu默認的python版本?你的錯誤建議qt實際上並沒有成功建立 – jdi 2011-12-21 19:38:00

+0

我的意思是沒有使用apt-get install python-qt4我試過了。想要嘗試下載package.qt構建問題? – Nava 2011-12-21 19:45:31

回答

5

你所遵循的指示是誤導和錯誤的。

你不需要在ubuntu 11.04上用QWebKit編譯任何東西來獲得PyQt4,因爲它已經包含了所有必需的包。

我建議你回滾你所做的任何更改,作爲遵循這些指示的結果,然後重新開始。

獲得一個基本的PyQt4的安裝,你只需要安裝這些軟件包:

(加上任何依賴關係,當然)。

+0

感謝您的信息;-) – Nava 2011-12-21 19:58:15

+0

我也試過教程:(如何回滾更改? – 2013-01-25 13:31:29

+0

沒關係,我想通了... – 2013-01-25 16:57:03

1

'教程'是完全廢話,並會搞砸你的系統。不幸的是,我在使用zip之後感到沮喪,並且無法正常工作(我不知道它在Ubuntu的存儲庫中)。

總之,只要在終端運行這段代碼:

sudo apt-get purge python-qt4 python-sip 
sudo apt-get install python-qt4 python-sip 

這應該解決這個問題。可選地,你也可以在Synaptic中執行此操作...