problem with pyqt.. help please...

Benjamin Kaplan benjamin.kaplan at
Sat Nov 21 15:05:00 CET 2009

On Sat, Nov 21, 2009 at 8:47 AM, Jebagnana Das <jebagnanadas at>wrote:

> Hi friends,
>              I've recently changed to ubuntu 9.04.. I've not had any
> problem with the installation of pyqt as it is available from the ubuntu
> repositories with umpteen number of packages.. Anyhow i've to download
> tarball file for python 3.1 and installed it.. I found that PyQt4 supports
> python 3.1(Am i right?)..
> I wanted to check the pyqt installation with a sample program..
> import sys
> from PyQt4 import QtGui
> app=QtGui.QApplication(sys.argv)
> widget=QtGui.QWidget()
> widget.resize(250,150)
> widget.setWindowTitle('Simple')
> sys.exit(app.exec_())
> when i issued the command
> $python
> it worked perfectly since it's executed with 2.6 installation..
> But when i tried to execute it with
> $python3
> it showed the error like
> ImportError: No module named PyQt4
> So i searched the sys.path for 2.6 and included
> /usr/lib/python2.6/dist-packages
> in python3 sys.path...
> Now when i tried to run this with python3  the error is like..
> ImportError: /usr/lib/python2.6/dist-packages/PyQt4/ undefined
> symbol: PyString_FromString
> I got the same error when i tried to execute another program... So can u
> please tell me how to solve this problem?? Am i heading in the right
> direction???...
> Thanks & Regards...
> Jebagnanadas,
> Python Learner..
As a general rule, never add packages that were installed for another
version of Python . There are inconsistencies between versions, so the C
libraries (like PyQT) always need to be recompiled. This is especially true
between Python 2.x and Python 3.x, where there were some fundamental changes
to the language. If you want to use PyQT on Python 3, download it and
compile it yourself.

> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list