dman
dman

Reputation: 137

PyQt5 not working on macOs sierra

I have been trying to use the pyqt5 library for close to over an 5 hours now, it keeps on saying:-

from PyQt5.QtGui import *

ImportError: dlopen(/usr/local/lib/python3.6/site-packages/PyQt5/QtGui.so, 2): Library not loaded: @rpath/QtGui.framework/Versions/5/QtGui
Referenced from: /usr/local/lib/python3.6/site-packages/PyQt5/QtGui.so Reason: image not found

Upvotes: 4

Views: 4972

Answers (3)

Ruslan
Ruslan

Reputation: 336

I solved this problem by going to Python 3.6. on OSX

Upvotes: 0

John
John

Reputation: 1445

I also encountered this problem with pyqt installed via conda, when importing the following:

from PyQt5 import QtGui, QtCore

Updating the package solved the problem for me.

pyqt: 5.6.0-py36_1 conda-forge --> 5.6.0-py36h8210e8a_6 conda-forge

Note that there's also a new version available (pyqt 5.9.2), but this update resolved my issue.

Upvotes: 0

dman
dman

Reputation: 137

Finally got it working , after 1 million fruitless tries.

  1. Get homebrew then brew install pyqt.
  2. LDFLAGS=-L/usr/local/opt/qt/lib CPPFLAGS=-I/usr/local/opt/qt/include pip3 install PyQt5 all on 1 line.

Then viola !

Upvotes: 7

Related Questions