在Windows 8.1上为Python 3.4 x64安装SIP 4.16.4和PyQt5.3.1

时间:2014-11-29 03:53:56

标签: python qt makefile python-sip

riverbankcomputing下载SIP 4.16.4.zip( windows source ) - 解压缩并从文件夹中运行configure.py。子目录sipgen,sip-lib现在与Python34和Makefile一起位于sipconfig.py目录中。

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

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

  

无法找到参考资料' QtCore'在' __ init __。py'

  

无法找到参考资料' QtWidgets'在' __ init __。py'

Qt***.pyd(QWidget,QLabel等)文件来自: Python34 \ lib中\站点包\ PyQt5
代码中使用的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

我是否需要使用其中的每一个来运行make和install,如果是这样,在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_())

1 个答案:

答案 0 :(得分:0)

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