我想在我的Mac上安裝PyQt,以便我可以安裝python ghost。我已經安裝了Qt和SIP。我已經下載PyQt的,但是當我運行安裝PyQt
python configure-ng.py
我得到以下錯誤:
Error: Use the --qmake argument to explicitly specify a working Qt qmake.
上我應該做的任何想法?
我想在我的Mac上安裝PyQt,以便我可以安裝python ghost。我已經安裝了Qt和SIP。我已經下載PyQt的,但是當我運行安裝PyQt
python configure-ng.py
我得到以下錯誤:
Error: Use the --qmake argument to explicitly specify a working Qt qmake.
上我應該做的任何想法?
configure-ng.py
既需要qmake
和sip
配置構建過程。
錯誤消息意味着configure-ng.py
找不到qmake
可執行文件。你需要指定它的位置,像這樣的東西:
$ python configure-ng.py --qmake=/path/to/qmake
QMAKE的位置取決於1)你如何安裝它,2)操作系統所使用。
對於Mac OS,少痛苦的方式(對我來說)是sip
和qmake
使用自制
$ brew install sip
$ brew install qt
brew
will install them in the directory:/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
may needs admin permission$ sudo make
非常有幫助,謝謝! – Oliver
不使用PyCharm IDE命令行。我也不需要安裝Qt .:
自動將要安裝的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_())
應明確指定工作的Qt做。 – Hyperboreus
我該怎麼做?我是否下載qmake或創建自己的?我對Qt不是很熟悉。 – steeling
@ user3417176。 qmake是Qt的一部分。您需要指定路徑,例如'--qmake path/to/qt/bin/qmake'。 – ekhumoro