gcloud/Google Cloud SDK의 gsutil이 bcrypt에서 'SyntaxError:잘못된 구문' 오류로 인해 실패함

gcloud/Google Cloud SDK의 gsutil이 bcrypt에서 'SyntaxError:잘못된 구문' 오류로 인해 실패함

오늘 사용하려고 하는데 gsutil다음과 같은 오류가 발생했습니다.

+ gsutil cp -nra public-read a gs://b

/usr/local/lib/python2.7/dist-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
  CryptographyDeprecationWarning,
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 13, in <module>
    import bootstrapping
  File "/usr/lib/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 44, in <module>
    from googlecloudsdk.core.credentials import store as c_store
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 40, in <module>
    from googlecloudsdk.core.credentials import creds as c_creds
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 34, in <module>
    from googlecloudsdk.core.credentials import devshell as c_devshell
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/credentials/devshell.py", line 33, in <module>
    from google.oauth2 import credentials
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/oauth2/credentials.py", line 43, in <module>
    from google.oauth2 import _client
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/oauth2/_client.py", line 35, in <module>
    from google.auth import jwt
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/auth/jwt.py", line 57, in <module>
    from google.auth import _service_account_info
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/auth/_service_account_info.py", line 22, in <module>
    from google.auth import crypt
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/auth/crypt/__init__.py", line 43, in <module>
    from google.auth.crypt import rsa
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/auth/crypt/rsa.py", line 20, in <module>
    from google.auth.crypt import _cryptography_rsa
  File "/usr/lib/google-cloud-sdk/lib/third_party/google/auth/crypt/_cryptography_rsa.py", line 25, in <module>
    from cryptography.hazmat.primitives import serialization
  File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/serialization/__init__.py", line 22, in <module>
    from cryptography.hazmat.primitives.serialization.ssh import (
  File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/serialization/ssh.py", line 27, in <module>
    from bcrypt import kdf as _bcrypt_kdf
  File "/usr/local/lib/python2.7/dist-packages/bcrypt/__init__.py", line 57
    def gensalt(rounds: int = 12, prefix: bytes = b"2b") -> bytes:
SyntaxError: invalid syntax

저는 Python 2( export CLOUDSDK_GSUTIL_PYTHON=python2)로 gsutil을 실행하고 있는데 도구나 OS가 밤새 bcrypt 3.2.0을 설치한 것 같습니다.Python 2에 대한 지원 중단.

이로 인해 gsutil 도구가 중단됩니다.

답변1

해결 방법은 도구를 실행하기 전에 수동으로 bcrypt 3.1.7로 다운그레이드하는 것입니다.

sudo pip install --system bcrypt==3.1.7

관련 정보