简体   繁体   English

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

[英]Installing SIP 4.16.4 and PyQt5.3.1 for Python 3.4 x64 on Windows 8.1

Downloaded SIP 4.16.4.zip( windows source ) from riverbankcomputing - Unpacked and ran configure.py from within the folder. 从下载SIP 4.16.4.zip( 窗口源riverbankcomputing -解压缩后的跑configure.py从文件夹内。 Sub-Directories sipgen, sip-lib are now in the Python34 directory along with sipconfig.py and Makefile. 子目录sipgen,sip-lib现在与sipconfig.py和Makefile一起位于Python34目录中。

I am unable to run any of the Makefiles either in the sipgen/sip-lib sub folders or in the main Python34 folder. 我无法在sipgen / sip-lib子文件夹或主Python34文件夹中运行任何Makefile。 Ran the installer for Py3.4-Qt5.3.1-x64 and the following test code from within PyCharm3.4.1 从PyCharm3.4.1中运行Py3.4-Qt5.3.1-x64和以下测试代码的安装程序

The code runs with exit code 0, but within the PyCharm editor, the import statements are flagged as 该代码以退出代码0运行,但是在PyCharm编辑器中,import语句被标记为

Cannot find reference 'QtCore' in '__init__.py' 在'__init__.py'中找不到引用'QtCore'

and

Cannot find reference 'QtWidgets' in '__init__.py' 在'__init__.py'中找不到引用'QtWidgets'

The Qt***.pyd (QWidget, QLabel, etc) files from: 来自以下位置的Qt***.pyd (QWidget,QLabel等)文件:
Python34\\lib\\site-packages\\PyQt5 Python34 \\ lib \\ site-packages \\ PyQt5
used in the code are flagged by PyCharm as Unresolved reference . 代码中使用的PyCharm标记为Unresolved reference

My goal is to install PyQt5.3.1x64 for Python 3.4x64 on Windows 8.1 - I have searched extensively and most of the doc/posts I've encountered are for Visual Studio applications or leads off into some tangent that is not applicable. 我的目标是在Windows 8.1上为Python 3.4x64安装PyQt5.3.1x64-我已经进行了广泛的搜索,我遇到的大多数文档/帖子都是针对Visual Studio应用程序的,或者导致一些切线不适用。

I'm looking for a concise procedure to install on windows and am not sure if I should also install some base QT by running qt-opensource-windows-x86-1.6.0-6-online.exe installer. 我正在寻找要在Windows上安装的简洁程序,并且不确定是否还应该通过运行qt-opensource-windows-x86-1.6.0-6-online.exe安装程序来安装一些基本QT。
I believe the problem is with not being able to run the make and make install steps for the Windows environment. 我认为问题在于无法运行Windows环境的make和make install步骤。 There is a Makefile in each of the following directories... 以下每个目录中都有一个Makefile ...
Python34: python34\\sipgen and python34\\siplib python34: python34 \\ sipgen和python34 \\ siplib

Do I need to run a make and install using each of these and if so how is this done on Windows 8.1? 我是否需要运行make并使用其中的每一个进行安装,如果是的话,如何在Windows 8.1上完成?

TEST CODE 测试代码

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

In another post it was suggested that the unresolved references are caused by a bug in PyCharm. 在另一篇文章中,有人提出未解决的引用是由PyCharm中的错误引起的。 The code runs fine but the IDE sets flags throughout for all the Qt components. 该代码运行良好,但是IDE会为所有Qt组件始终设置标志。 If anyone else is trying to install sip and Qt5 on windows 8 and needs help contact me and I will be glad to give step by step instructions using Visual Studio Developer Command Prompt. 如果有人尝试在Windows 8上安装sip和Qt5,并且需要帮助,请与我联系,我将很高兴使用Visual Studio Developer Command Prompt提供逐步指导。

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

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