在Windows上使用OpenSSL支持构建PyQt5? [英] Build PyQt5 on Windows with OpenSSL support?

查看:97
本文介绍了在Windows上使用OpenSSL支持构建PyQt5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建具有SSL支持的PyQt5,但是直到现在,我还是没有成功.

I'm trying to build PyQt5 with SSL support but, until now, I have no success at all.

我做了什么:

  • 使用OpenSSL支持重建Qt:确定

configure.exe -static -debug-and-release -opensource -confirm-license -nomake examples -nomake tests -opengl desktop -platform win32-g++ -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I C:\OpenSSL-Win32\include -L C:\OpenSSL-Win32\lib

mingw32-make

  • 安装SIP:确定

    python configure.py -p win32-g++
    mingw32-make
    mingw32-make install
    

  • 安装PyQt5:确定

    python configure.py --spec=win32-g++
    mingw32-make
    mingw32-make install
    

    • 编辑configure.py文件,在QtWebKitWidgets ModuleMetadata上添加'printsupport':

      • Edit the configure.py file, adding a 'printsupport' on QtWebKitWidgets ModuleMetadata:

        'QtWebKitWidgets': ModuleMetadata(qmake_QT=['webkitwidgets', 'printsupport']),

        代替

        'QtWebKitWidgets': ModuleMetadata(qmake_QT=['webkitwidgets']),

        mingw32-make之后(或之前?),删除行

        After (or before?) the mingw32-make, remove the line

        -strip C:$(INSTALL_ROOT)\Python34\pyuic5.bat

        :

        测试:不好

        >>> from PyQt5.QtNetwork import QSslSocket
        >>> QSslSocket.supportsSsl()
        False
        

      • 所以,我的问题是:

        1. 我做错什么了吗?
        2. 是否需要其他配置?

        为什么我要问...如果一切正常,我正在尝试(使用QWebview)访问某些https URL,但是却出现了很多错误或SSL错误,例如:

        Why I'm asking that...If everything is "ok", I'm trying to access (with a QWebview) some https URLs and I'm getting lot or SSL erros, such as:

            QSslSocket: cannot call unresolved function SSLv23_client_method
            QSslSocket: cannot call unresolved function SSL_CTX_new
            QSslSocket: cannot call unresolved function SSL_library_init
            QSslSocket: cannot call unresolved function ERR_get_error
        

        提前谢谢!

        推荐答案

        问题已解决!

        1. 下载并安装OpenSSL的轻量"版本
        2. 按照上述过程在OpenSSL支持下重建Qt +安装SIP +安装PyQt
        3. ssleay32.dlllibeay32.dlllibssl32.dll复制到Qt> mingw> bin文件夹(在我的情况下为C:\Qt\Qt5.3.2\5.3\mingw482_32\bin)
        1. Download and Install the "Light" version of OpenSSL
        2. Follow the above procedure to Rebuild Qt with OpenSSL support + Install SIP + Install PyQt
        3. Copy ssleay32.dll, libeay32.dll and libssl32.dll to the Qt > mingw > bin folder (C:\Qt\Qt5.3.2\5.3\mingw482_32\bin in my case)

        现在,进行QSslSocket.supportsSsl()测试时,您会看到很大的True.

        Now you can see a big True when you do a QSslSocket.supportsSsl() test.

        这篇关于在Windows上使用OpenSSL支持构建PyQt5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆