您现在的位置是:首页 > 文章详情

在macos上基于python2.7安装PyQt5

日期:2019-03-04点击:406

在macos上基于python2.7安装PyQt5

在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 >>>

 

参考文档:

https://fredrikaverpil.github.io/2015/11/25/compiling-pyqt5-for-python-2-7-on-os-x/

原文地址https://www.cnblogs.com/dylancao/p/10476251.html

原文链接:https://yq.aliyun.com/articles/692400
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章