How to check if PyQt5 is installed correctly on Mac?

I followed the instructions below:

http://danmarner.com/2014/04/23/Installing-PyQt5-with-Python-3-On-OS-X.html

to install SIP first according to the instructions found at:

http://pyqt.sourceforge.net/Docs/sip4/installation.html

and then PyQt5, following the instructions given here:

http://pyqt.sourceforge.net/Docs/PyQt5/installation.html

and then brew install qt5

but when I run the first example PyQt-gpl-5.3.2/examples/tutorials/addressbook/part1.py

it fails with the following:

Traceback (most recent call last):
  File "examples/tutorials/addressbook/part1.py", line 45, in <module>
    from PyQt5.QtCore import Qt
ImportError: No module named PyQt5.QtCore

      

I am running Mavericks 10.9.5 and Python 2.7.5

It doesn't seem to be installed correctly, or if python cannot find it. I'm not sure how to proceed, so any suggestions are greatly appreciated!

+3


source to share


2 answers


The issue was resolved by adding /usr/local/lib/python2.7/site-packages

PYTHONPATH. Thanks to the comments found here:

fooobar.com/questions/217312 / ...



and @Kash and @qqvc for suggestions!

+1


source


if you used brew you can add to .bashrc

export PYTHONPATH=$(brew --prefix)/lib/python3.6/site-packages:$PYTHONPATH

      

(edit python3.6 to your python version).



And then restart bash and run

echo $PYTHONPATH

      

if the answer is not zero, thats ok

+1


source







All Articles