CentOS安裝PyQT5

CentOS安裝PyQT5.11

yum install qt5-qtbase-devel
pip3 install pyqt5
python3 -c "from PyQt5 import QtWidgets"css

CentOS安裝PyQT5.6

1、安裝CentOS7

  1. 安裝完成後進行更新
    sudo yum update -y
  2. 增長epel 源
    yum install epel-release -y

2、 安裝qt5

  1. 安裝qt5.6
    yum install qt5-qtquickcontrols qt5-qtdeclarative-devel -y

3、 安裝PyQT5

  1. 安裝編譯環境
    yum install gcc gcc-c++ python-devel -y
  2. 下載sip-4.18
    wget http://nchc.dl.sourceforge.net/project/pyqt/sip/sip-4.18/sip-4.18.tar.gz
  3. 裝sip-4.18
   sudo tar xzvf sip-4.18.tar.gz    sudo cd sip    sudo python configure.py    sudo make    sudo make install 
  1. 下載pyqt5.6
    wget http://nchc.dl.sourceforge.net/project/pyqt/PyQt5/PyQt-5.6/PyQt5_gpl-5.6.tar.gz
  2. 安裝qt5-qtbase-devel
    yum install qt5-qtbase-devel -y
  3. 編譯並安裝 pyqt
   sudo tar xzvf PyQt5_gpl-5.6.tar.gz
   sudo cd PyQt5_gpl-5.6    sudo python configure.py --qmake=/usr/bin/qmake-qt5    sudo make all    sudo make install

tip:
  1.步驟sudo python configure.py --qmake=/usr/bin/qmake-qt5會出錯:
    Error: This version of PyQt5 and the commercial version of Qt have incompatible licenses.
     解決辦法:
    vi configure.py #大約在2681行,可根據關鍵字搜索
              修改紅色標記處: if introspecting and target_config.qt_licensee not in 'Open Source' and ltype == 'GPL':python

  2. 步驟sudo make all 會出錯:c++

    error: 'WindowOkButtonHint' : is not a member of 'Qt'bash

    error: 'WindowCancelButtonHint' : is not a member of 'Qt'ui

  解決辦法:根絕報錯大約是在/root/PyQt5_gpl-5.6/QtCore/sipQtCoreQt.cpp 的1085和1098行,  刪除這兩行就行了
spa


from:https://stackoverflow.com/questions/31825633/pyqt5-5-and-qt5-licence-issue.net

相關文章
相關標籤/搜索