Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在支持OpenSSL的Windows上构建PyQt5?_Qt_Ssl_Openssl_Pyqt5_Qsslsocket - Fatal编程技术网

在支持OpenSSL的Windows上构建PyQt5?

在支持OpenSSL的Windows上构建PyQt5?,qt,ssl,openssl,pyqt5,qsslsocket,Qt,Ssl,Openssl,Pyqt5,Qsslsocket,我正在尝试使用SSL支持构建PyQt5,但直到现在,我还没有成功 我所做的: 使用OpenSSL支持重建Qt:OK configure.exe -static -debug-and-release -opensource -confirm-license -nomake examples -nomake tests -opengl desktop -platform win32-g++ -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -

我正在尝试使用SSL支持构建PyQt5,但直到现在,我还没有成功

我所做的:

  • 使用OpenSSL支持重建Qt:OK

    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
    
    python configure.py -p win32-g++
    mingw32-make
    mingw32-make install
    
    python configure.py --spec=win32-g++
    mingw32-make
    mingw32-make install
    
    >>> from PyQt5.QtNetwork import QSslSocket
    >>> QSslSocket.supportsSsl()
    False
    
  • 安装SIP:正常

    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
    
    python configure.py -p win32-g++
    mingw32-make
    mingw32-make install
    
    python configure.py --spec=win32-g++
    mingw32-make
    mingw32-make install
    
    >>> from PyQt5.QtNetwork import QSslSocket
    >>> QSslSocket.supportsSsl()
    False
    
  • 安装PyQt5:正常

    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
    
    python configure.py -p win32-g++
    mingw32-make
    mingw32-make install
    
    python configure.py --spec=win32-g++
    mingw32-make
    mingw32-make install
    
    >>> from PyQt5.QtNetwork import QSslSocket
    >>> QSslSocket.supportsSsl()
    False
    
    • 编辑
      configure.py
      文件,在QtWebKitWidgets ModuleMetadata上添加
      'printsupport'

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

      而不是

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

    • mingw32 make
      之后(或之前?)删除该行

      -strip C:$(安装\u ROOT)\Python34\pyuic5.bat

      从目标
      安装\u pyuic5

  • 测试:不正常

    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
    
    python configure.py -p win32-g++
    mingw32-make
    mingw32-make install
    
    python configure.py --spec=win32-g++
    mingw32-make
    mingw32-make install
    
    >>> from PyQt5.QtNetwork import QSslSocket
    >>> QSslSocket.supportsSsl()
    False
    
因此,我的问题是:

  • 我做错什么了吗
  • 是否需要其他配置
  • 为什么我要问……如果一切都“正常”,我尝试访问(使用QWebview)一些
    https
    URL,我会收到很多或SSL错误,例如:

        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
    
    提前谢谢你

    问题解决了

  • 下载并安装OpenSSL的“轻”版本
  • 按照上述步骤使用OpenSSL支持+安装SIP+安装PyQt重建Qt
  • ssleay32.dll
    libeay32.dll
    libssl32.dll
    复制到Qt>mingw>bin文件夹(
    C:\Qt\Qt5.3.2\5.3\mingw482\u 32\bin
  • 现在,您可以在执行
    qsslssocket.supportssl()
    测试时看到一个大的
    True