问题
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:
- Am I doing anything wrong?
- 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!
- Download and Install the "Light" version of OpenSSL
- Follow the above procedure to Rebuild Qt with OpenSSL support + Install SIP + Install PyQt
- Copy
ssleay32.dll
,libeay32.dll
andlibssl32.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