• Python-Mac 安装 PyQt4-转


    原文地址:http://www.cnblogs.com/JohnABC/p/6232973.html   下面内容略微不同

    环境:

      系统: OS X 10.11.4

      Python: 2.7.10

    1.安装 Qt

    brew install qt

      测试安装结果,需要正确找到 qmake 的路径

    qmake (安装完我输qmake没反应,需要到qt的安装路径去找#/usr/local/Cellar/qt/5.9.1/bin/qmake)

    2.安装 SIP 

      下载(sip-4.18.1.tar.gz): https://riverbankcomputing.com/software/sip/download (我用迅雷下的用tar解压不了,用浏览器默认下载的正常)

    复制代码
    tar -xzf sip-4.18.1.tar.gz
    cd sip-4.18.1
    
    python configure.py -d /Library/Python/2.7/site-packages --arch=x86_64
    
    make
    sudo make install

    复制代码

      #如果 sudo make install 的时候报如下错误

    cp -f sip /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip
    cp: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip: Operation not permitted
    make[1]: *** [install] Error 1
    make: *** [install] Error 2

      #解决方法

          #重启 Mac

          #按住 Command + R 直到出现苹果 Logo

          #进入 Recoverary 模式

              #菜单栏 > 实用工具 > 终端

          #输入 csrutil disable (如果想再次改回来,输入 csrutil enable)

              #重启 Mac

    3.PyQt4

      下载(PyQt-mac-gpl-4.11.4.tar.gz): https://riverbankcomputing.com/software/pyqt/download (我用迅雷下的用tar解压不了,用浏览器默认下载的正常)

      查看 qmake 路径

    which qmake #/usr/local/bin/qmake
    (我使用which qmake找不到qmake路径,需要到qt的安装路径去找#/usr/local/Cellar/qt/5.9.1/bin/qmake)

      安装

    安装时出现报错:Error: This version of PyQt4 and the commercial version of Qt have incompatible licenses.

    解决方法:注释掉configure-ng.py下面语句即可:

    if introspecting and target_config.qt_licensee not in OPEN_SOURCE_LICENSEES and ltype == 'GPL':
            error(
                    "This version of PyQt4 and the commercial version of Qt have "
                    "incompatible licenses.")
    
    复制代码
    tar -xzf PyQt-mac-gpl-4.11.4.tar.gz
    cd PyQt-mac-gpl-4.11.4
    
    python configure-ng.py -q /usr/local/bin/qmake -d /Library/Python/2.7/site-packages/ --sip /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip
    
    make
    sudo make install
    复制代码

    4.测试

    import PyQt4
  • 相关阅读:
    置入式广告 场景中并无实际对应物
    文本自动摘要的方法研究
    [翻译]用DataSource控件以外的方法为GridView提供数据
    留个纪念
    新街口
    [翻译]SharePoint2007中创建Forms认证方式的站点
    路不一定是死的
    网站转移小记
    [转载]什么时候使用webservice
    城市周末的夜还是那么美
  • 原文地址:https://www.cnblogs.com/v-BigdoG-v/p/7264162.html
Copyright © 2020-2023  润新知