Python2.7安装Google Cloud SDK遇SSLHandshakeError求助
Hey there, let's get this Google Cloud SDK installation issue sorted out for you. That SSL handshake error you're hitting is super common with older Python versions like 2.7.14, and here are actionable fixes to try:
First, let's recap your error for clarity
httplib2.python2.httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
This happens because Python 2.7.14's default CA certificate bundle is often outdated, or your system is missing the root certificates needed to trust Google's servers.
Solutions to try (in order of recommendation)
1. Update your CA certificates and point Python to them
First, make sure your system has up-to-date root certificates:
- On Linux, run:
sudo update-ca-certificates - On macOS (with Homebrew installed):
brew install openssl
Then set an environment variable to tell the installation script to use this updated bundle:
# Linux example export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt # macOS example (with Homebrew openssl) export REQUESTS_CA_BUNDLE=/usr/local/etc/openssl/cert.pem
Now re-run the Google Cloud SDK installation script.
2. Bypass SSL verification temporarily (for installation only)
If updating certificates doesn't work, you can disable SSL checks during installation (note: this is not recommended for production use, only for getting the SDK installed). Run the install script with this flag:
./install.sh --disable-ssl-certificate-check
3. Update httplib2 to a compatible version
Older versions of httplib2 (which the SDK relies on) have known SSL issues with Python 2.7. Install the latest compatible version first:
pip install httplib2==0.20.4
This version supports Python 2.7 and fixes many SSL-related bugs. Then re-run the installation script.
4. Check your system clock
Believe it or not, an incorrect system time can cause SSL certificate verification to fail. Make sure your system time is synced with an NTP server:
- On Linux:
sudo ntpdate pool.ntp.org - On macOS: Go to System Preferences > Date & Time > Check "Set date and time automatically"
内容的提问来源于stack exchange,提问作者Mikmac

