0

从Riverbankcomputing下载 SIP 4.16.4.zip( windows source ) - 解压并从文件夹中运行。子目录 sipgen、sip-lib 现在与 Makefile 一起在目录中。configure.pyPython34sipconfig.py

我无法在 sipgen/sip-lib 子文件夹或主Python34文件夹中运行任何 Makefile。从 PyCharm3.4.1 中运行 Py3.4-Qt5.3.1-x64 的安装程序和以下测试代码

该代码以退出代码 0 运行,但在 PyCharm 编辑器中,导入语句被标记为

在“__init__.py”中找不到引用“QtCore”

在“__init__.py”中找不到引用“QtWidgets”

代码中使用的来自Python34\lib\site-packages\PyQt5Qt***.pyd(QWidget、QLabel 等)文件 被标记为Unresolved reference

PyCharm

我的目标是在 Windows 8.1 上为 Python 3.4x64 安装 PyQt5.3.1x64 - 我进行了广泛的搜索,我遇到的大多数文档/帖子都是针对 Visual Studio 应用程序的,或者导致一些不适用的切线。

我正在寻找在 Windows 上安装的简明程序,但不确定是否还应该通过运行 qt-opensource-windows-x86-1.6.0-6-online.exe 安装程序来安装一些基本 QT。
我认为问题在于无法为 Windows 环境运行 make 和 make 安装步骤。在以下每个目录中都有一个Makefile ...
Python34: python34\sipgen 和 python34\siplib

我是否需要使用其中的每一个运行制作和安装,如果需要,如何在 Windows 8.1 上完成?

测试代码

from PyQt5.QtCore import *
from PyQt5.QtWidgets import *

class Form(QWidget):
    def \__init__(self, parent=None):
        super(Form, self).\__init__(parent)

        nameLabel = QLabel("Name:")
        self.nameLine = QLineEdit()
        self.submitButton = QPushButton("&Submit")
        buttonLayout1 = QVBoxLayout()
        buttonLayout1.addWidget(nameLabel)
        buttonLayout1.addWidget(self.nameLine)
        buttonLayout1.addWidget(self.submitButton)

        self.submitButton.clicked.connect(self.submitContact)

        mainLayout = QGridLayout()
        # mainLayout.addWidget(nameLabel, 0, 0)
        mainLayout.addLayout(buttonLayout1, 0, 1)

        self.setLayout(mainLayout)
        self.setWindowTitle("Hello Qt")

        def submitContact(self):
        name = self.nameLine.text()

if name == "":
    QMessageBox.information(self, "Empty Field",
                                "Please enter a name and address.")
    return
else:
    QMessageBox.information(self, "Success!",
                                "Hello %s!" % name)

if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    screen = Form()
    screen.show()
    sys.exit(app.exec_())
4

1 回答 1

0

在另一篇文章中,有人建议未解决的引用是由 PyCharm 中的错误引起的。代码运行良好,但 IDE 为所有 Qt 组件设置了标志。如果其他人试图在 Windows 8 上安装 sip 和 Qt5 并且需要帮助,请联系我,我很乐意使用 Visual Studio 开发人员命令提示符提供逐步说明。

于 2014-12-04T16:51:20.353 回答