Google Cloud SDK 安装失败 UnicodeDecodeError:“ascii”编解码器

2024-05-07

我在安装时遇到以下错误谷歌云SDK https://cloud.google.com/sdk/docs/在我的 Windows 10 计算机上:

ERROR: gcloud failed to load: 'ascii' codec can't decode byte 0xe1 in position 13: ordinal not in range(128)
    gcloud_main = _import_gcloud_main()
    import googlecloudsdk.gcloud_main
    from googlecloudsdk.calliope import cli
    from googlecloudsdk.calliope import backend
    from googlecloudsdk.calliope import parser_extensions
    from googlecloudsdk.core.updater import update_manager
    from googlecloudsdk.core.updater import installers
    from googlecloudsdk.core.credentials import store
    from googlecloudsdk.core.credentials import creds
    from googlecloudsdk.core.credentials import devshell as c_devshell
    from oauth2client import client
    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:\AndroidSdk\CloudSdk\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:\AndroidSdk\CloudSdk\google-cloud-sdk\\bin\bootstrapping\install.py", line 12, in <module>
    import bootstrapping
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\bin\bootstrapping\bootstrapping.py", line 44, in <module>
    from googlecloudsdk.core.credentials import store as c_store
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\googlecloudsdk\core\credentials\store.py", line 35, in <module>
    from googlecloudsdk.core.credentials import creds
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\googlecloudsdk\core\credentials\creds.py", line 34, in <module>
    from googlecloudsdk.core.credentials import devshell as c_devshell
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\googlecloudsdk\core\credentials\devshell.py", line 30, in <module>
    from oauth2client import client
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\third_party\oauth2client\client.py", line 51, in <module>
    from oauth2client import crypt
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\third_party\oauth2client\crypt.py", line 45, in <module>
    from oauth2client import _openssl_crypt
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\third_party\oauth2client\_openssl_crypt.py", line 16, in <module>
    from OpenSSL import crypto
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\OpenSSL\crypto.py", line 12, in <module>
    from cryptography import x509
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\__init__.py", line 9, in <module>
    from cryptography.x509.base import (
  File "C:\AndroidSdk\CloudSdk\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:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\extensions.py", line 13, in <module>
    from asn1crypto.keys import PublicKeyInfo
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\keys.py", line 22, in <module>
    from ._elliptic_curve import (
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_elliptic_curve.py", line 51, in <module>
    from ._int import inverse_mod
  File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_int.py", line 56, in <module>
    from ._perf._big_num_ctypes import libcrypto
  File "C:\AndroidSdk\CloudSdk\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:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\ctypes\util.py", line 53, in find_library
    fname = os.path.join(directory, name)
  File "C:\AndroidSdk\CloudSdk\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 13: ordinal not in range(128)
Failed to install.

我尝试重新下载安装程序,使用管理员权限运行它,并且选择了一个没有任何非 ASCII 字符或空格的安装文件夹。

我还验证了安装程序是否成功设置了 python,更具体地说,我在 C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\python.exe 处有 Python 版本 2.7.13

我也尝试过设置CLOUDSDK_PYTHON变量没有成功。

注:我看到了这个question https://stackoverflow.com/q/50486322/3162918,但我有不同版本(213.0.0)的cloud-sdk,并且我在代码中没有找到提到的部分,所以我不认为这是一个重复的问题。

EDIT 1:

我的 ntpath.py 第 63-90 行:

def join(path, *paths):
    """Join two or more pathname components, inserting "\\" as needed."""
    result_drive, result_path = splitdrive(path)
    for p in paths:
        p_drive, p_path = splitdrive(p)
        if p_path and p_path[0] in '\\/':
            # Second path is absolute
            if p_drive or not result_drive:
                result_drive = p_drive
            result_path = p_path
            continue
        elif p_drive and p_drive != result_drive:
            if p_drive.lower() != result_drive.lower():
                # Different drives => ignore the first path entirely
                result_drive = p_drive
                result_path = p_path
                continue
            # Same drive in different case
            result_drive = p_drive
        # Second path is relative to the first
        if result_path and result_path[-1] not in '\\/':
            result_path = result_path + '\\'
        result_path = result_path + p_path   #85
    ## add separator between UNC and non-absolute path
    if (result_path and result_path[0] not in '\\/' and
        result_drive and result_drive[-1:] != ':'):
        return result_drive + sep + result_path
    return result_drive + result_path

EDIT 2:

感谢您的建议我也检查了这些问题和答案,但我找不到解决方案:

UnicodeDecodeError:“ascii”编解码器无法解码位置 13 中的字节 0xe2:序数不在范围内(128) https://stackoverflow.com/questions/18649512/unicodedecodeerror-ascii-codec-cant-decode-byte-0xe2-in-position-13-ordinal

Bitbucket 管道:gcloud 崩溃 (UnicodeDecodeError) https://stackoverflow.com/questions/51620611/bitbucket-pipelines-gcloud-crashed-unicodedecodeerror

注意我的 gcloud 路径中没有任何非 ASCII 字符,我用以下命令检查了它:gci -recurse . | where {$_.Name -match "[^\u0000-\u007F]"}

还有其他想法如何解决吗?


只是要尝试的事情的列表:

  1. 安装Python从https://www.python.org/downloads/release/python-2715/ https://www.python.org/downloads/release/python-2715/。记住该位置python二进制。将其设置为CLOUDSDK_PYTHON

  2. 显示带有变量集的打印输出。

  3. 确保变量确实已设置。

  4. In C:\ (or C:\AndroidSdk,但最佳情况下C:\): 跑过gci命令输入https://superuser.com/questions/237533/find-files-with-non-ascii-characters-in-filenames-in-windows-xp https://superuser.com/questions/237533/find-files-with-non-ascii-characters-in-filenames-in-windows-xp,显示输出。或者从同一问题运行 python 程序。

  5. 会被 4. 找到,但第 13 个字符似乎是\。尝试重新创建目录,给出AndroidSDK一个更短/更长的名字,看看它是否仍然是第13个字符

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Google Cloud SDK 安装失败 UnicodeDecodeError:“ascii”编解码器 的相关文章

  • 通过 python 中的另外两个修改数组[重复]

    这个问题在这里已经有答案了 假设我们有三个一维数组 A 长度为 5 B 长度相同 示例中为5 C 更长 比如长度为 100 C最初用零填充 A给出索引C应更改的元素 它们可能会重复 以及B给出应添加到初始零的值C 例如 如果A 1 3 3
  • 使用 NumPy 编写一个函数来计算具有特定公差的积分

    我想编写一个自定义函数来以特定容差对表达式 python 或 lambda 函数 进行数字积分 我知道与scipy integrate quad人们可以简单地改变epsabs但我想使用 numpy 自己编写该函数 From 这篇博文 htt
  • 查找正在导入哪些 python 模块

    从应用程序中使用的特定包中查找所有 python 模块的简单方法是什么 sys modules是将模块名称映射到模块的字典 您可以检查其键以查看导入的模块 See http docs python org library sys html
  • 高级描述熊猫

    有没有像 pandas 那样更高级的功能 通常我会继续这样 r pd DataFrame np random randn 1000 columns A r describe 我会得到一份很好的总结 就像这样 A count 1000 000
  • 无法使用 python rasterio、gdal 打开 jp2 (来自哨兵)

    我试图在 python 中将 jp2 栅格产品作为栅格打开 但当我们使用 raterio 和 gdal 包时没有成功 我收到此错误 RasterioIOError b4 jp2 not recognized as a supported f
  • python Recipe:列出最接近等于值的项[关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 考虑像这样的列表 0 3 7 10 12 15 19 21 我想获得最接近任何值的最近的最小数字 所以如果我通过4 我会得到3 如果我
  • Django 2、python 3.4 无法解码 urlsafe_base64_decode(uidb64)

    我正在尝试通过电子邮件激活用户 电子邮件有效 编码有效 我使用了 django1 11 中的方法 该方法运行成功 在 Django 1 11 中 以下内容成功解码为 28 其中 uidb64 b Mjg force text urlsafe
  • 为什么 Collections.counter 这么慢?

    我正在尝试解决罗莎琳德的基本问题 即计算给定序列中的核苷酸 并在列表中返回结果 对于那些不熟悉生物信息学的人来说 它只是计算字符串中 4 个不同字符 A C G T 出现的次数 我期望collections Counter是最快的方法 首先
  • 如何获取分类数据的分组条形图

    I have a big dataset with information about students And I have to build a graph of dependencies between different value
  • 从 wxPython 事件处理程序中调用函数

    我正在努力寻找一种在 wxPython 事件处理函数中使用函数的方法 假设我有一个按钮 单击该按钮时 它会使用事件处理程序运行一个名为 OnRun 的函数 但是 用户忘记单击 OnRun 按钮之前的 RadionButton 我想弹出一个
  • 从迭代器外部将 StopIteration 发送到 for 循环

    有几种方法可以打破一些嵌套循环 他们是 1 使用中断 继续 for x in xrange 10 for y in xrange 10 print x y if x y gt 50 break else continue only exec
  • Python 2.7 缩进错误[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 这个问题是由拼写错误或无法再重现的问题引起的 虽然类似的问题可能是on topic help on topic在这里 这个问题的解决方式不
  • Django 将 JSON 数据传递给静态 getJSON/Javascript

    我正在尝试从 models py 中获取数据并将其序列化为views py 中的 JSON 对象 模型 py class Platform models Model platformtype models CharField max len
  • 如何创建用于霍夫曼编码和解码的树?

    对于我的作业 我将对霍夫曼树进行编码和解码 我在创建树时遇到问题 并且陷入困境 不要介意打印语句 它们只是让我测试并查看函数运行时的输出是什么 对于第一个 for 循环 我从主块中用于测试的文本文件中获取了所有值和索引 在第二个 for 循
  • Python 读取未格式化的直接访问 Fortran 90 给出不正确的输出

    这是数据的写入方式 它是一个二维浮点矩阵 我不确定大小 open unit 51 file rmsd nn output form unformatted access direct status replace recl Npoints
  • 两种 ODE 求解器之间的差异

    我想知道 两者之间有什么区别ODEINT and solve ivp用于求解微分方程 它们之间有什么优点和缺点 f1 solve ivp f 0 1 y0 y0 is the initial point f2 odeint f y0 0 1
  • pandas.read_fwf 忽略提供的数据类型

    我正在从文本文件导入数据框 我想指定列的数据类型 但 pandas 似乎忽略了dtype input 一个工作示例 from io import StringIO import pandas as pd string USAF WBAN S
  • 使用 pandas 单元格中列表的长度选择行[重复]

    这个问题在这里已经有答案了 我有一张表 df a b c 1 x y x 2 x z c d 3 x t e f g 只是想知道如何使用 c 列的长度选择行 such as df loc len df c gt 1 我知道这是不对的 正确的
  • MoviePY 无法在 Windows 上检测 ImageMagick 二进制文件

    我刚买了一台新笔记本电脑 想要设置MoviePY在那新的Windows 64x Python3 7 0 机器 我对所有内容都进行了三次检查 但是当涉及到我的代码的文本部分时 它向我抛出了这个错误 OSError MoviePy Error
  • 在Python中停止ThreadPool中的进程

    我一直在尝试为控制某些硬件的库编写一个交互式包装器 用于 ipython 有些调用对 IO 的影响很大 因此并行执行任务是有意义的 使用 ThreadPool 几乎 效果很好 from multiprocessing pool import

随机推荐