[PyQt] Cannot import name QtGui

Wade Spires wspires at cs.ucf.edu
Sat May 17 15:05:07 BST 2008


Hi,

I am new to pyqt development.  I am trying to just run some of the
example programs but am getting this import error:
  PyQt-x11-gpl-4.4 # ./examples/tutorial/t1.py
  Traceback (most recent call last):
    File "./examples/tutorial/t1.py", line 6, in ?
      from PyQt4 import QtGui
  ImportError: cannot import name QtGui

It looks like PyQt is installed:
  PyQt-x11-gpl-4.4 # ls /usr/lib64/python2.4/site-packages/PyQt4/
  elementtree/   QtAssistant.so*  QtGui.so*      Qt.so*     QtTest.so*
  __init__.py    QtCore.so*       QtNetwork.so*  QtSql.so*  QtXml.so*
  pyqtconfig.py  QtDesigner.so*   QtOpenGL.so*   QtSvg.so*  uic/

I tried setting my PYTHONPATH and LD_LIBRARY_PATH environment
variables to include /usr/lib64/python2.4/site-packages and
/usr/lib64/python2.4/site-packages/PyQt4/ respectively, but this did
not solve the problem.  I can import PyQt4 itself, but it doesn't seem
to have any modules available such as QtGui or QtCore.

Any idea on what the problem is and how to solve it?  I apologize if
such a simple problem has already been answered, but I didn't see it
in the archive.

Thank you,
Wade


More information about the PyQt mailing list