I am not able to import pyqt4 after upgrading my Ubuntu from 16.04 to 18.04.
I tried re-installing pyqt4 and python. I also updated source.list but nothing worked for me. It was working all good before this update. This is the error:
Traceback (most recent call last): File "main.py", line 1, in <module> from PyQt4 import QtGui # Import the PyQt4 module we'll need
ImportError: /usr/lib/python2.7/dist-packages/PyQt4/QtGui.x86_64-linux-gnu.so: undefined symbol: _ZN15QSessionManager16staticMetaObjectEWhat can I do about this?
11 Answer
It seems that you should install one package python-qt4:
sudo apt-get install python-qt4After installation you will be able to import PyQt4:
$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtGui
>>> 1