这可能是 gsutil/boto 如何处理 Windows 上的操作系统路径分隔符的问题,如在此处引用的那样。这最终应该被合并到 sdk 工具中,但在此之前,以下应该可以工作:
转到
google-cloud-sdk\platform\gsutil\third_party\boto\boto\pyami\config.py
并替换该行:
for path in os.environ['BOTO_PATH'].split(':'):
和:
for path in os.environ['BOTO_PATH'].split(os.path.pathsep):
接下来,转到
google-cloud-sdk\bin\bootstrapping\gsutil.py
替换使用 ':' 的行
if boto_config:
boto_path = ':'.join([boto_config, gsutil_path])
elif boto_path:
# this is ':' for windows as well, hardcoded into the boto source.
boto_path = ':'.join([boto_path, gsutil_path])
else:
path_parts = ['/etc/boto.cfg',
os.path.expanduser(os.path.join('~', '.boto')),
gsutil_path]
boto_path = ':'.join(path_parts)
和
if boto_config:
boto_path = os.path.pathsep.join([boto_config, gsutil_path])
elif boto_path:
# this is ':' for windows as well, hardcoded into the boto source.
boto_path = os.path.pathsep.join([boto_path, gsutil_path])
else:
path_parts = ['/etc/boto.cfg',
os.path.expanduser(os.path.join('~', '.boto')),
gsutil_path]
boto_path = os.path.pathsep.join(path_parts)
重新加载 cmd 并且错误应该消失。