Reputation: 3
I get the following error when I try to import a submodule of pyqt4 in macosx 10.10 on python 2.7.9:
$ python -c "from PyQt4 import QtCore"
ImportError: dlopen(/Users/Desktop/lib/python2.7/
site-packages/PyQt4/QtCore.so, 2): Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore
Referenced from: /Users/Desktop/lib/python2.7/
site-packages/PyQt4/QtCore.so
Reason: image not found
I installed pyqt4 from:
https://riverbankcomputing.com/software/pyqt/download
PyQt-mac-gpl-4.11.4.tar.gz MacOS/X source
cd PyQt-mac-gpl-4.11.4 python configure-ng.py --destdir=/Users/Desktop/lib/python2.7/site- packages --sip-incdir=/Users/Desktop/include make make install
I have a 64 bit python 2.7.9 and I installed qt using online installer. I did not compile it from the source since that takes a huge amount of memory.
I installed qt using:
qt-unified-mac-x64-2.0.2-2-online.dmg, which is a 64 bit qt.
I noticed that every .so files created by pyqt4 refers to some dylib which does not exist anymore. For instance, QtGui.so refers to libQtGui.dylib, QtWidgets.so refers to libQtWidgets.dylib, and so forth. Every PyQt4 Qt.so should have a matching libQt.dylib, it appears.
Does anyone have any idea how I can fix this?
Thanks!
Upvotes: 0
Views: 720
Reputation: 11
I solved this problem by uninstalling qt5.5 and install qt-opensource-mac-4.8.6-1.dmg. After the installation, just recompile pyqt4 and make install. As below
python configure.py -q /usr/bin/qmake-4.8 -d /Library/Python/2.7/site-packages/ --sip /Library/Frameworks/Python.framework/Versions/2.7/bin/sip
make
make install
Upvotes: 1
Reputation: 3
I solved this problem by making sure that I install sip and pyqt4 for the same architecture.
Specifically, I installed sip with arch flag, which I had not done before.
python configure.py -d /somefolder/lib/python2.7/site-packages -e /somefolder/lib/python2.7/site-packages -p darwin-g++ --arch x86_64
Then make make install.
Later I installed pyqt4
python configure.py --destdir=/somefolder/lib/python2.7/site-packages --use-arch= x86_64 make make install
This seems to have solved my problem and I can import pyqt4 submodules without any error.
Upvotes: 0