Ubuntu 18.04下PyQt5访问HTTPS URL时QNetworkReply报Error99求助
Hey there! Let's tackle this Error 99 issue you're hitting when making HTTPS requests with QNetworkReply after switching to Ubuntu 18.04. I've dealt with similar network/SSL quirks between Ubuntu versions, so here are practical steps to resolve it:
Common Causes & Solutions
1. System CA Certificate Path Mismatch
Ubuntu 18.04 uses a different default CA certificate setup compared to 16.04, and PyQt5's Qt library might not be picking up the system certificates correctly. Try explicitly loading the system CA bundle in your request:
from PyQt5.QtNetwork import QNetworkRequest, QSslConfiguration, QSslCertificate, QUrl @pyqtSlot() def sendRequest(self): request = QNetworkRequest(QUrl("your_https_target_url")) # Load Ubuntu 18.04's system CA certificates ca_cert_path = "/etc/ssl/certs/ca-certificates.crt" system_certs = QSslCertificate.fromPath(ca_cert_path) # Update SSL configuration with the loaded certificates ssl_config = QSslConfiguration.defaultConfiguration() ssl_config.setCaCertificates(system_certs) request.setSslConfiguration(ssl_config) # Send your request as usual self.networkManager.get(request)
2. Missing/Incompatible SSL Libraries
Ubuntu 18.04 shifted to OpenSSL 1.1.x, while 16.04 used 1.0.x. If your PyQt5's Qt build doesn't support the newer OpenSSL version, you'll run into network errors. First, check if SSL is supported by your Qt setup:
from PyQt5.QtNetwork import QSslSocket print("SSL Supported:", QSslSocket.supportsSsl()) print("Current SSL Library Version:", QSslSocket.sslLibraryVersionString()) print("Qt's Built SSL Version:", QSslSocket.sslLibraryBuildVersionString())
If SSL isn't supported or versions don't match, install the required Qt SSL plugins and OpenSSL libraries:
sudo apt-get update && sudo apt-get install libqt5network5-plugins libssl1.1
Restart your application after installing these packages.
3. Incomplete Server Certificate Chain
Some servers don't send the full certificate chain, which can cause verification failures on newer systems. Only use this for testing environments—never disable certificate validation in production:
from PyQt5.QtNetwork import QSslSocket # Inside sendRequest() ssl_config = QSslConfiguration.defaultConfiguration() ssl_config.setPeerVerifyMode(QSslSocket.VerifyNone) request.setSslConfiguration(ssl_config)
4. Unintended Proxy Interference
Ubuntu 18.04's system proxy settings might be affecting Qt's network requests. Try explicitly disabling proxies for your network manager:
from PyQt5.QtNetwork import QNetworkProxy # Initialize your network manager with no proxy self.networkManager = QNetworkAccessManager(self) self.networkManager.setProxy(QNetworkProxy(QNetworkProxy.NoProxy))
Final Notes
Start with checking SSL support and loading the system CA certificates—those are the most common fixes for this issue on Ubuntu 18.04. If none of these work, try testing against a well-known HTTPS endpoint (like https://example.com) to rule out server-specific issues.
内容的提问来源于stack exchange,提问作者Alain Berrier

