[英]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.