标签:获取 https .gz usr project tar source com 用户安装
在python3上面安装PyQt5是十分简单的,可是,在python2.7上安装这个东西,着实让人折腾了一把。要总结一下,年纪大了,记性不好。
首先要安装最新版的Qt和python2,命令如下:
brew install python qt5
接下来获取PyQt5的源码,命令如下:
wget http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.6/PyQt5_gpl-5.6.tar.gz
wget http://freefr.dl.sourceforge.net/project/pyqt/sip/sip-4.18/sip-4.18.tar.gz
接下来是编译和运行代码:
tar -xvf sip-4.18.tar.gz cd /sip-4.18 python configure.py -d /usr/local/lib/python2.7/site-packages/ make make install cd.. tar -xvf PyQt-gpl-5.6.tar.gz cd PyQt-gpl-5.6 python configure.py -d /usr/local/lib/python2.7/site-packages/ --qmake=/usr/local/Cellar/qt5/5.6.0/bin/qmake --sip=/usr/local/bin/sip --sip-incdir=../sip-4.18/siplib make make install
注意:这里面的sip和qmake是要看你自己的目录的,不同的用户安装路径可能不一样。
接下来检查是否安装成功:
? PyQt5_gpl-5.6 python2 Python 2.7.15 (default, Feb 22 2019, 14:56:11) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import PyQt5 >>>
参考文档:
1 https://fredrikaverpil.github.io/2015/11/25/compiling-pyqt5-for-python-2-7-on-os-x/
标签:获取 https .gz usr project tar source com 用户安装
原文地址:https://www.cnblogs.com/dylancao/p/10476251.html