Installing PyQt4 on Mac OSx Mavericks?
You can install it with homebrew using the --with-python3
flag:
unset PYTHONPATHbrew install sip --with-python3brew install pyqt --with-python3
And relink the site packages if necessary.
The easiest way I've found is to use MacPorts. Once installed, simply run
sudo port install py34-pyqt4
and it will do the rest - install Python 3.4, pyqt4, and all the dependencies. You'll need to configure PyCharm to use the MacPorts version of Python (found in /opt/local/bin
), but after that you should be all set. There are many modules available through MacPorts, and for those that aren't you can always install py34-pip
.
I know this is from a year ago but this may help someone...
Note: This is for PyQT5 and Python 3. It is an alternative to using homebrew.
Background
If you installed Python 3.x, it installs in a separate directory (leaving your Mac version alone). After adding the new directories
to your path, most people can just use python3.5
(or whatever version) to access it without having to change over python
alias.
Also note that Python comes with pip
right out of the box...
Read more on Python 3 for Mac here.
Answer the question already
Now, all that said, you can simply use the following to install via pip:
sudo python3.5 -m pip install PyQt5
You'll likely have to use sudo
. Output should look like:
Collecting PyQt5 Downloading PyQt5-5.7-cp35-cp35m-macosx_10_6_intel.whl (79.4MB) 100% |████████████████████████████████| 79.4MB 18kB/s Collecting sip (from PyQt5) Downloading sip-4.18.1-cp35-cp35m-macosx_10_6_intel.whl (46kB) 100% |████████████████████████████████| 51kB 9.8MB/s Installing collected packages: sip, PyQt5Successfully installed PyQt5-5.7 sip-4.18.1
Don't forget to use the -m
option. It allows for library modules to be run as scripts. From the --help
entry:
-m mod : run library module as a script (terminates option list)
Note: Older versions of PyQT cannot be installed via pip.