Skip to content

Instantly share code, notes, and snippets.

@kilfu0701
Created April 24, 2015 16:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save kilfu0701/47b74a17a70b43549985 to your computer and use it in GitHub Desktop.
Save kilfu0701/47b74a17a70b43549985 to your computer and use it in GitHub Desktop.
Install PyQt5 with Python2.7 on Mac
cd ~
mkdir dev_tools
cd dev_tools
## download SIP source code
wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.7/sip-4.16.7.tar.gz
tar zxf sip-4.16.7.tar.gz
cd sip-4.16.7
python configure.py
make
make install
## environ for pyQT
export PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH"
export PATH="/Users/fu/Qt/5.4/clang_64/bin:$PATH"
## check for python's package path
python -c "import site; print site.getsitepackages()"
## compile pyQT ...
python configure.py \
-q /Users/fu/Qt/5.4/clang_64/bin/qmake \
-d /Library/Python/2.7/site-packages/ \
--sip /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip
make
sudo make install
## test if pyQT is installed
# test.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
w = QtWidgets.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
# Refs:
# http://www.phodal.com/blog/pyqt5-mac-os-install/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment