How can I install PyQT4 for Python 2.7?

I am trying to install PyQT4 on Python 2.7.9, I am on Mac OS X, so I tried installing it through Homebrew and Macports, unfortunately they did not work.

This is what I tried:

brew install python qt pyqt pyside pyside-tools 

also tried:

 brew install PyQT4 

In Macports:

 sudo port install py27-pyqt4 

No matter what I did, I was getting this error:

 >>>> import PyQT4 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named PyQT4 

What could be the problem? Do I need to set the env path for PyQT?

+5
source share
1 answer

Decision:

I installed the PyQtX package (PyQt binary for Mac OS X) from here .

and then specify PYTHONPATH as follows:

 export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH 

After entering import PyQt4 into import PyQt4 it worked without problems. (Case sensitive)

+7
source

Source: https://habr.com/ru/post/1247099/


All Articles