我正在尝试在我的mac上安装PyQt,这样我就可以安装python ghost了。我已经安装了Qt和SIP。我下载了PyQt,但当我运行
python configure-ng.py 我得到以下错误:
Error: Use the --qmake argument to explicitly specify a working Qt qmake.我该怎么做你有什么建议吗?
发布于 2014-10-26 20:15:00
既然你用的是Mac,我就用Homebrew。前几天这对我很有效,但花了很长时间才完成:
brew install pyqt发布于 2015-04-07 04:52:49
configure-ng.py需要qmake和sip来配置构建过程。
该错误消息表示configure-ng.py找不到qmake可执行文件。您需要指定它的位置,如下所示:
$ python configure-ng.py --qmake=/path/to/qmake
qmake的位置取决于1)您如何安装它和2)您使用的操作系统。
对于Mac,一种不那么痛苦的方法(在我的例子中)是使用Homebrew安装sip和qmake
$ brew install sip
$ brew install qt
brew将在以下目录中安装它们:/usr/local/Cellar/
然后,运行configure-ng.py并指定两个位置:
$ python configure-ng.py --qmake=/usr/local/Cellar/qt/VERSION/bin/qmake --sip=/usr/local/Cellar/sip/VERSION/bin/sip如果一切正常,请继续PyQt安装:
$ make make需要一段时间(在我的例子中大约需要20分钟)。
最后,安装:
$ make install
make可能需要$ sudo make
的管理员权限
发布于 2017-05-04 02:08:16
使用PyCharm集成开发环境,不使用命令行的。我也不需要安装Qt。:
Python Python3.6.1(双击install).

它会自动安装PyQt 5.8.2和SIP.安装完后,返回到Project Interpreter,并确保也安装了SIP。如果没有安装:'+‘按钮并安装sip。

试试这段代码,看看它是否也适用于你。:)
#!/usr/bin/env python3
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QWidget
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setFixedSize(200, 100)
self.setWindowTitle('Example')
label = QLabel('Hello')
layout = QVBoxLayout()
layout.addWidget(label)
layout.setAlignment(Qt.AlignCenter)
self.setLayout(layout)
if __name__ == '__main__':
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())

https://stackoverflow.com/questions/22678954
复制相似问题