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”编解码器 的相关文章

  • 使用 Django 的 post_save() 信号

    我有两张桌子 class Advertisement models Model created at models DateTimeField auto now add True author email models EmailField
  • 用 Python 编写一个无操作或虚拟类

    假设我有这样的代码 foo fooFactory create 由于种种原因 fooFactory create 可能无法创建实例Foo 如果可以的话我想要fooFactory create 返回一个虚拟 无操作对象 这个对象应该是完全惰性
  • Sorted(key=lambda: ...) 背后的语法[重复]

    这个问题在这里已经有答案了 我不太明白背后的语法sorted 争论 key lambda variable variable 0 Isn t lambda随意的 为什么是variable在看起来像的内容中陈述了两次dict 我认为这里的所有
  • 使用正则表达式解析 Snort 警报文件

    我正在尝试使用 Python 中的正则表达式从 snort 警报文件中解析出源 目标 IP 和端口 和时间戳 示例如下 03 09 14 10 43 323717 1 2008015 9 ET MALWARE User Agent Win9
  • Python3 查找 2 个列表中有多少个差异才能相等

    假设我们有 2 个列表 always具有相同的长度和always包含字符串 list1 sot sot ts gg gg gg list2 gg gg gg gg gg sot 我们需要找到 其中有多少项list2应该改变 以便它等于lis
  • python ttk treeview:如何选择并设置焦点在一行上?

    我有一个 ttk Treeview 小部件 其中包含一些数据行 如何设置焦点并选择 突出显示 指定项目 tree focus set 什么也没做 tree selection set 0 抱怨 尽管小部件明显填充了超过零个项目 但未找到项目
  • 当x轴不连续时如何删除冗余日期时间 pandas DatetimeIndex

    我想绘制一个 pandas 系列 其索引是无数的 DatatimeIndex 我的代码如下 import matplotlib dates as mdates index pd DatetimeIndex 2000 01 01 00 00
  • 行为:如何从另一个文件导入步骤?

    我刚刚开始使用behave http pythonhosted org behave 一个Pythonic BDD框架 使用小黄瓜语法 http docs behat org guides 1 gherkin html 行为需要一个特征 例
  • 反加入熊猫

    我有两个表 我想附加它们 以便仅保留表 A 中的所有数据 并且仅在其键唯一时添加表 B 中的数据 键值在表 A 和 B 中是唯一的 但在某些情况下键将出现在表 A 和 B 中 我认为执行此操作的方法将涉及某种过滤联接 反联接 以获取表 B
  • 如何为多组精灵创建随机位置?

    我尝试使用 blit 和 draw 方法进行 for 循环 并为 PlayerSprite 和 Treegroup 使用不同的变量 for PlayerSprite in Treegroup surface blit PlayerSprit
  • 如何逐像素绘制正方形(Python,PIL)

    在空白画布上 我想使用 Pillow 逐像素绘制一个正方形 我尝试使用 img putpixel 30 60 155 155 55 绘制一个像素 但它没有执行任何操作 from PIL import Image def newImg img
  • FastText - 由于 C++ 扩展未能分配内存,无法加载 model.bin

    我正在尝试使用 FastText Python APIhttps pypi python org pypi fasttext https pypi python org pypi fasttext虽然 据我所知 此 API 无法加载较新的
  • Python 矩阵每一行的总和

    lista 1 2 3 4 5 6 7 8 9 print lista def filas lista res for elemento in lista x sum lista elemento res append x print re
  • 使用 lambda 函数更改属性值

    我可以使用 lambda 函数循环遍历类对象列表并更改属性值 对于所有对象或满足特定条件的对象 吗 class Student object def init self name age self name name self age ag
  • Plotly:如何避免巨大的 html 文件大小

    我有一个 3D 装箱模型 它使用绘图来绘制输出图 我注意到 绘制了 600 个项目 生成 html 文件需要很长时间 文件大小为 89M 这太疯狂了 我怀疑可能存在一些巨大的重复 或者是由单个项目的 add trace 方法引起的 阴谋 为
  • 是否可以强制浮点数的指数或有效数匹配另一个浮点数(Python)?

    这是我前几天试图解决的一个有趣的问题 是否可以强制一个的有效数或指数float与另一个人一样float在Python中 出现这个问题是因为我试图重新调整一些数据 以便最小值和最大值与另一个数据集匹配 然而 我重新调整后的数据略有偏差 大约小
  • asyncio - 多次等待协程(周期性任务)

    我正在尝试为异步事件循环创建定期任务 如下所示 但是我收到 RuntimeError 无法重用已等待的协程 异常 显然 asyncio 不允许等待相同的可等待函数 如中讨论的这个错误线程 https bugs python org issu
  • 如何在单独的文件中使用 FastAPI Depends 作为端点/路由?

    我在单独的文件中定义了一个 Websocket 端点 例如 from starlette endpoints import WebSocketEndpoint from connection service import Connectio
  • PyQt 中的线程和信号问题

    我在 PyQt 中的线程之间进行通信时遇到一些问题 我使用信号在两个线程 发送者和监听者 之间进行通信 发送者发送消息 期望被监听者接收 但是 没有收到任何消息 谁能建议可能出了什么问题 我确信这一定很简单 但我已经环顾了几个小时但没有发现
  • 如何使用 Django (Python) 登录表单?

    我在 Django 中构建了一个登录表单 现在我遇到了路由问题 当我选择登录按钮时 表单不会发送正确的遮阳篷 我认为前端的表单无法从 查看 py 文件 所以它不会发送任何 awnser 并且登录过程无法工作 该表单是一个简单的静态 html

随机推荐