Skip to content

Instantly share code, notes, and snippets.

@bgromov
Last active August 17, 2021 03:12
Show Gist options
  • Save bgromov/ed3d5875bd01c52a270601681ec2f557 to your computer and use it in GitHub Desktop.
Save bgromov/ed3d5875bd01c52a270601681ec2f557 to your computer and use it in GitHub Desktop.
PyQt5 with SIP 4.19.1 for Python 2.7 with virtualenv under macOS Sierra

Preparation

Install Qt5 with homebrew and link it to the system (potentially destructive operation):

$ brew install qt5
$ brew unlink qt # may fail if no Qt4 was installed previously with homebrew
$ brew link --force qt5

Additionally, it might be worth to activate the appropriate target virtualenv with:

$ workon <target_virtualenv>

SIP 4.19.1 Installation

Download:

$ wget https://netix.dl.sourceforge.net/project/pyqt/sip/sip-4.19.1/sip-4.19.1.tar.gz
$ tar zxf sip-4.19.1.tar.gz

Configure:

$ cd sip-4.19.1

Make sure the environment variable VIRTUAL_ENV is set, and then:

$ python configure.py --deployment-target=10.12 --destdir=${VIRTUAL_ENV}/lib/python2.7/site-packages --incdir=${VIRTUAL_ENV}/include/python2.7

Build & Install

$ make
$ make install

PyQt5 Installation

Download

$ wget https://kent.dl.sourceforge.net/project/pyqt/PyQt5/PyQt-5.8/PyQt5_gpl-5.8.tar.gz
$ tar zxf PyQt5_gpl-5.8.tar.gz

Configure

$ cd PyQt5_gpl-5.8

Make sure the environment variable VIRTUAL_ENV is set, and then:

$ python configure.py --sip=${VIRTUAL_ENV}/bin/sip --sip-incdir=${VIRTUAL_ENV}/include/python2.7/ --qmake=/usr/local/bin/qmake --verbose

If configure complains regarding the licence of XCode, do the following (Stack Overflow answer):

$ cd /Applications/Xcode.app/Contents/Developer/usr/bin/
$ sudo ln -s xcodebuild xcrun

Build & Install

$ make
$ make install
@xlla
Copy link

xlla commented Aug 17, 2021

does not generate PyQt5.sip,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment