- 
      
- 
        Save liorbenhorin/ce772e00e334812df0c0c83384b7c1b2 to your computer and use it in GitHub Desktop. 
    Install PyQt5 with Python2.7 on Mac
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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