Build PyQt5 on Windows with OpenSSL support?

≡放荡痞女 提交于 2019-12-11 04:48:10

问题


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

What I have done:

  • Rebuild Qt with OpenSSL Support: 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
    
  • Install SIP: OK

    python configure.py -p win32-g++
    mingw32-make
    mingw32-make install
    
  • Install PyQt5: OK

    python configure.py --spec=win32-g++
    mingw32-make
    mingw32-make install
    
    • Edit the configure.py file, adding a 'printsupport' on QtWebKitWidgets ModuleMetadata:

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

      instead of

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

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

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

      from target install_pyuic5:

  • Test: NOT OK

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

So, my questions are:

  1. Am I doing anything wrong?
  2. Is there any other configuration needed?

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

Thank you in advance!


回答1:


Problem solved!

  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)

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



来源:https://stackoverflow.com/questions/27392247/build-pyqt5-on-windows-with-openssl-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!