Mac-安装pyqt

为后来者踩雷,大多数安装方式都是第二种,既麻烦又费时,安装方式有两种:

  • Installing from Wheels
  • Building and Installing from Source

采用第二种安装方式:遇到最严重的问题是:

Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

#目前还没有查到有效的解决办法,可靠的一些说法来自PyQt for Mac安装:推荐 Qt5.5+PyQt5 或者 Qt4.8+PyQt4 否则就会出现 Error: Failed to determine the detail of your Qt installation.

并且按照:Python - Mac下PyQt5环境搭建,的安装配置,还是会出现:

Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

所以,倒腾了半天,还是选择用第一种方式安装 pyqt5,有爱倒腾的小伙伴们,如果解决了那个问题,一定要通知我

PyQt5官方安装教程

brew install python3
pip3 install pyqt5
#或者
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyqt5
$ python
>>> import PyQt5

安装完成,跑个小demo

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('Hello PyQt')
    w.show()
    sys.exit(app.exec_())

这里写图片描述
明天开始写代码

参考博文:https://blog.csdn.net/tymatlab/article/details/78625089

猜你喜欢

转载自blog.csdn.net/sinat_33588424/article/details/80230253