简体   繁体   English

如何在Visual Studio 2015中使用PyQt5?

[英]How to use PyQt5 in Visual Studio 2015?

Is there possible to use PyQt5 in Visual Studio 2015? 是否有可能在Visual Studio 2015中使用PyQt5?
I installed PyQt and created python project. 我安装了PyQt并创建了python项目。 I get an error. 我收到一个错误。

No module named 'PyQt5' 没有名为'PyQt5'的模块
If there is a handler for this exception, the program may be safely continued. 如果存在此异常的处理程序,则可以安全地继续该程序。

What do I have to do? 我需要做什么?

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()

Try this: In "Solution Explorer" choose "References"->"Add Reference"->"Browse"- tab, where select *.pyd files in (Python installation folder)\\Python34\\Lib\\site-packages\\PyQt4. 试试这个:在“Solution Explorer”中选择“References” - >“Add Reference” - >“Browse” - tab,选择*(Python安装文件夹)\\ Python34 \\ Lib \\ site-packages \\ PyQt4中的* .pyd文件。 Then in code one can use something like this: "from Qt import * " 然后在代码中可以使用这样的东西:“来自Qt import *”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM