Skip to content

Instantly share code, notes, and snippets.

@dingzeyuli
Forked from kilfu0701/install.sh
Last active June 19, 2017 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingzeyuli/0dd939192b8302ca61b992f2a4000637 to your computer and use it in GitHub Desktop.
Save dingzeyuli/0dd939192b8302ca61b992f2a4000637 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/dinli/Qt/5.9/clang_64/bin:$PATH"
## check for python's package path
python -c "import site; print site.getsitepackages()"
## compile pyQT ...
python configure.py \
-q /Users/dinli/Qt/5.9/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