简体   繁体   中英

How to use PyQt5 in Visual Studio 2015?

Is there possible to use PyQt5 in Visual Studio 2015?
I installed PyQt and created python project. I get an error.

No module named '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. Then in code one can use something like this: "from Qt import * "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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