在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
所以,我的问题是:
- 我做错什么了吗?
- 是否需要其他配置?
为什么我要问...如果一切正常,我正在尝试(使用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
提前谢谢!
-
问题已解决!
- 下载并安装OpenSSL的轻量"版本
- 按照上述过程在OpenSSL支持下重建Qt +安装SIP +安装PyQt
- 将
ssleay32.dll
,libeay32.dll
和libssl32.dll
复制到Qt> mingw> bin文件夹(在我的情况下为C:\Qt\Qt5.3.2\5.3\mingw482_32\bin
)
- 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)
现在,进行QSslSocket.supportsSsl()
测试时,您会看到很大的True
.
Now you can see a big True
when you do a QSslSocket.supportsSsl()
test.