执行某些代码时Gcloud安装代码错误

问题描述 投票:0回答:1

我已经下载了google cloud安装程序并解压到一个文件夹中,我已经安装了python 3.13。但是当我尝试在 mac 64_86 机器中获取 ./installsh 文件时,它失败并出现以下错误

  Traceback (most recent call last):
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/connectionpool.py", line 717, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/connectionpool.py", line 406, in _make_request
    self._validate_conn(conn)
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/connectionpool.py", line 1057, in _validate_conn
    conn.connect()
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
                ^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/util/ssl_.py", line 454, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/util/ssl_.py", line 498, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1108, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1379, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='dl.google.com', port=443): Max retries exceeded with url: /dl/cloudsdk/channels/rapid/components-2.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/xxxx/google-cloud-sdk/bin/bootstrapping/install.py", line 395, in <module>
    main()
  File "/Users/xxxx/google-cloud-sdk/bin/bootstrapping/install.py", line 368, in main
    Install(
  File "/Users/xxxx/google-cloud-sdk/bin/bootstrapping/install.py", line 228, in Install
    _CLI.Execute(['--quiet', 'components', 'list'])
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 1024, in Execute
    self._HandleAllErrors(exc, command_path_string, specified_arg_names)
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 1061, in _HandleAllErrors
    exceptions.HandleError(exc, command_path_string, self.__known_error_handler)
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/calliope/exceptions.py", line 557, in HandleError
    core_exceptions.reraise(exc)
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/exceptions.py", line 149, in reraise
    six.reraise(type(exc_value), exc_value, tb)
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/six/__init__.py", line 719, in reraise
    raise value
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 998, in Execute
    resources = calliope_command.Run(cli=self, args=args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 842, in Run
    resources = command_instance.Run(args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/surface/components/list.py", line 102, in Run
    result = update_manager.List(show_hidden=args.show_hidden,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 759, in List
    to_print, current_version, latest_version = self._GetPrintListWithDiff()
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 802, in _GetPrintListWithDiff
    _, diff = self._GetStateAndDiff(command_path='components.list')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 685, in _GetStateAndDiff
    latest_snapshot = self._GetLatestSnapshot(version=version,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 668, in _GetLatestSnapshot
    return snapshots.ComponentSnapshot.FromURLs(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py", line 175, in FromURLs
    data = [
           ^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py", line 176, in <listcomp>
    (ComponentSnapshot._DictFromURL(
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py", line 200, in _DictFromURL
    response = installers.MakeRequest(url, command_path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py", line 115, in MakeRequest
    return _RawRequest(url, headers=headers, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py", line 163, in _RawRequest
    return retryer.RetryOnException(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 201, in RetryOnException
    exceptions.reraise(exc_info[1], tb=exc_info[2])
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/exceptions.py", line 149, in reraise
    six.reraise(type(exc_value), exc_value, tb)
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/six/__init__.py", line 719, in reraise
    raise value
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 182, in TryFunc
    return func(*args, **kwargs), None
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py", line 196, in _ExecuteRequestAndRaiseExceptions
    response = requests_session.get(
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/requests/sessions.py", line 557, in get
    return self.request('GET', url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/transport.py", line 269, in WrappedRequest
    response = orig_request(*modified_args, **modified_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/googlecloudsdk/core/requests.py", line 246, in WrappedRequest
    return orig_request_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/requests/sessions.py", line 544, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/requests/sessions.py", line 657, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxxx/google-cloud-sdk/lib/third_party/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='dl.google.com', port=443): Max retries exceeded with url: /dl/cloudsdk/channels/rapid/components-2.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))
google-cloud-platform gcloud
1个回答
0
投票

看看这个 Stack Overflow 问题 的解决方案,它与您的问题有相同的问题。如果它不能解决您的问题,您可以尝试通过运行以下命令来禁用 ssl 验证,尽管禁用它不是最佳实践。

gcloud config set auth/disable\_ssl\_validation True

您还可以查看这个在MAC上安装CLI的官方文档

© www.soinside.com 2019 - 2024. All rights reserved.