Google Cloud 'ascii' codec can't decod

2019-05-23 03:52发布

问题:

I'm trying to install the GoogleCloudSDK and I get the following error during installation:

    Output folder: C:\Program Files (x86)\Google\Cloud SDK
Downloading Google Cloud SDK core.
Extracting Google Cloud SDK core.
Create Google Cloud SDK bat file: C:\Program Files (x86)\Google\Cloud SDK\cloud_env.bat
Installing components.
Welcome to the Google Cloud SDK!
ERROR: gcloud failed to load: 'ascii' codec can't decode byte 0xe1 in position 9: ordinal not in range(128)
    gcloud_main = _import_gcloud_main()
    import googlecloudsdk.gcloud_main
    from googlecloudsdk.calliope import base
    from googlecloudsdk.calliope import display
    from googlecloudsdk.calliope import display_taps
    from googlecloudsdk.core.resource import resource_printer_base
    from googlecloudsdk.core.resource import resource_projector
    from apitools.base.py import encoding as protorpc_encoding
    from apitools.base.py.base_api import *
    from apitools.base.py import http_wrapper
    from oauth2client.client import HttpAccessTokenRefreshError as TokenRefreshError  # noqa
    from oauth2client import crypt
    from oauth2client import _openssl_crypt
    from OpenSSL import crypto
    from OpenSSL import crypto, SSL
    from cryptography import x509
    from cryptography.x509.base import (
    from cryptography.x509.extensions import Extension, ExtensionType
    from asn1crypto.keys import PublicKeyInfo
    from ._elliptic_curve import (
    from ._int import inverse_mod
    from ._perf._big_num_ctypes import libcrypto
    libcrypto_path = find_library('crypto')
    fname = os.path.join(directory, name)
    result_path = result_path + p_path
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 executable:
    C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
    https://cloud.google.com/sdk/
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\\bin\bootstrapping\install.py", line 8, in <module>
    import bootstrapping
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\bootstrapping.py", line 17, in <module>
    import oauth2client.contrib.gce as gce
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\oauth2client\contrib\gce.py", line 25, in <module>
    from oauth2client import client
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\oauth2client\client.py", line 51, in <module>
    from oauth2client import crypt
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\oauth2client\crypt.py", line 45, in <module>
    from oauth2client import _openssl_crypt
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\oauth2client\_openssl_crypt.py", line 16, in <module>
    from OpenSSL import crypto
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\OpenSSL\crypto.py", line 12, in <module>
    from cryptography import x509
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\__init__.py", line 9, in <module>
    from cryptography.x509.base import (
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\base.py", line 16, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\extensions.py", line 13, in <module>
    from asn1crypto.keys import PublicKeyInfo
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\keys.py", line 22, in <module>
    from ._elliptic_curve import (
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_elliptic_curve.py", line 51, in <module>
    from ._int import inverse_mod
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_int.py", line 56, in <module>
    from ._perf._big_num_ctypes import libcrypto
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_perf\_big_num_ctypes.py", line 31, in <module>
    libcrypto_path = find_library('crypto')
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\ctypes\util.py", line 53, in find_library
    fname = os.path.join(directory, name)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 9: ordinal not in range(128)
Failed to install.

I have already tried the solutions some solutions including setting my environment variable to a Python 2.7 installation, what else could be the problem? If it helps I already had anaconda navigator installed in my pc with a default Python3 build, maybe that could be causing conflicts?

回答1:

This seems to be related to an old issue on the SDK. I encourage you to submit a new defect report as described in this article so that proper attention and weight will be given to it. We monitor that issue tracker closely.