[英]How to use PyQt5 in Visual Studio 2015?
是否有可能在Visual Studio 2015中使用PyQt5?
我安裝了PyQt並創建了python項目。 我收到一個錯誤。
沒有名為'PyQt5'的模塊
如果存在此異常的處理程序,則可以安全地繼續該程序。
我需要做什么?
import sys
from PyQt5 import QtWidgets
def main():
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
button = QtWidgets.QPushButton("Hello world")
window.setCentralWidget(button)
window.show()
app.exec_()
if __name__ == '__main__':
main()
試試這個:在“Solution Explorer”中選擇“References” - >“Add Reference” - >“Browse” - tab,選擇*(Python安裝文件夾)\\ Python34 \\ Lib \\ site-packages \\ PyQt4中的* .pyd文件。 然后在代碼中可以使用這樣的東西:“來自Qt import *”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.