I've installed Qt5.2.1 / SIP 4.5.15 and PyQt5 on my Ubuntu 12.4 desktop. Everything seemed OK until I try to import QtWebKitWidgets. This module is very important in my code.

>>> from PyQt5 import QtWebkitWidgets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name QtWebkitItems
>>>

No error raised during the installation phase. in my /opt/Qt5.2.1/5.2.1/gcc_64/lib directory I can see the corresponding Qt libs.

Does anyone have an idea ?

Thank you in advance

enter image description here

有帮助吗?

解决方案

I'm not sure where you're getting "QtWebkitItems" from (a web-search gets no hits other than this page), but the real problem is a simple typo. The import statement should be:

    from PyQt5 import QtWebKitWidgets # upper-case K!

PS: it's nicely ironic that you managed to spell it right in your question, and even highlighted it in bold!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top