[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Including the Pyca cryptography library\n\nThis page describes how to update the Google Cloud CLI to enable support for\nautomatically wrapping keys for secure import into Cloud Key Management Service, by\ninstalling the\n[Pyca cryptography library](https://cryptography.io). Version 2.2.0\nor higher adds support for the required `aes_key_wrap_with_padding` wrapping\nmechanism.\n\nBefore you begin\n----------------\n\n- [Install or upgrade the Google Cloud CLI](/sdk/install) to version 253.0.0 or higher.\n- Install the `pip` command if possible. `pip` is the platform-independent command-line interface to the [Python Package Index](https://pypi.python.org/pypi/pip). The package manager provided by your operating system may not provide version 2.2.0 or higher of the Pyca cryptographic library.\n\n| **Important:** If you specified your Python version with the [CLOUDSDK_PYTHON environment variable](https://cloud.google.com/sdk/gcloud/reference/topic/startup), ensure that same version is active when you install the Pyca cryptographic library.\n\nInstalling and using pip\n------------------------\n\nYou can install and use `pip` on Linux, macOS, or Windows systems.\n\nThis command installs the library into your user environment, specifying the\nminimum version to install. To install system-wide, omit the\n`--user` flag. You may need to install `pip` as a privileged user. \n\n```\npip install --user \"cryptography\u003e=2.2.0\"\n```\n\n\nAfter installing the Pyca cryptographic libraries, you must\n[enable site packages](#enable_site_packages) so the gcloud CLI can use\nthe libraries.\n\nInstalling on Linux using a package manager\n-------------------------------------------\n\nFollow these instructions on Linux systems if you can't use the `pip` command.\n\n### Debian or Ubuntu\n\nIf you use a system based on Debian or Ubuntu, you can install the Pyca\ncryptographic library using the `apt-get` command.\n\n1. Check the versions of the `python-cryptography` package available in the\n package database. Version 2.2.0 or higher is required.\n\n ```\n apt policy python-cryptography\n ```\n2. Install the package.\n\n ```\n sudo apt-get install python-cryptography\n ```\n\n If necessary, specify the version to install. \n\n ```\n sudo apt-get install python-cryptography=version\n ```\n | **Note:** Use an `=` (equals sign) between the package name and version.\n\n\nAfter installing the Pyca cryptographic libraries, you must\n[enable site packages](#enable_site_packages) so the gcloud CLI can use\nthe libraries.\n\n### Red Hat, CentOS, or SUSE\n\nIf your system uses RPMs for package management, you can install the Pyca\ncrytographic library using the `yum` command.\n\n1. Check the versions of `python-cryptography` available in the package\n database. Version 2.2.0 or higher is required.\n\n ```\n yum --showduplicates list python2-cryptography\n ```\n2. Install the package.\n\n ```\n sudo yum install python2-cryptography\n ```\n\n If necessary, specify the version to install. \n\n ```\n sudo yum install python2-cryptography-version\n ```\n | **Note:** Use a `-` (hyphen) between the package name and version.\n\n\nAfter installing the Pyca cryptographic libraries, you must\n[enable site packages](#enable_site_packages) so the gcloud CLI can use\nthe libraries.\n\nEnabling site packages\n----------------------\n\nBy default, the Google Cloud CLI ignores Python libraries installed on your local\nsystem. To allow the Google Cloud CLI to use the Pyca cryptographic library, you\nneed to enable site packages.\n\nTo enable site packages, set the\n`CLOUDSDK_PYTHON_SITEPACKAGES` environment variable to `1`. With site packages\nenabled, the gcloud CLI can use extra libraries outside of the\n`google-cloud-sdk/lib` directory. \n\n### Linux\n\n```\nexport CLOUDSDK_PYTHON_SITEPACKAGES=1\n```\n\n### macOS\n\n```\nexport CLOUDSDK_PYTHON_SITEPACKAGES=1\n```\n\n### Windows\n\n```\nset CLOUDSDK_PYTHON_SITEPACKAGES=1\n```\n\nEnabling site packages may cause some gcloud CLI commands to fail.\nIt is recommended that you [disable site packages](#disabling_site_packages)\nafter importing your keys.\n\nDisabling site packages\n-----------------------\n\nAfter you finish importing keys, it is recommended that you disable site\npackages on systems where you use the gcloud CLI. To disable site\npackages, set `CLOUDSDK_PYTHON_SITEPACKAGES` to `0`. \n\n### Linux\n\n```\nexport CLOUDSDK_PYTHON_SITEPACKAGES=0\n```\n\n### macOS\n\n```\nexport CLOUDSDK_PYTHON_SITEPACKAGES=0\n```\n\n### Windows\n\n```\nset CLOUDSDK_PYTHON_SITEPACKAGES=0\n```"]]