在AWS EC2上获取AWS Systems Manager参数时遇cryptography缺失错误的解决方法
解决AWS EC2执行
aws ssm get-parameter时的No module named 'cryptography'错误 这个错误是由于AWS CLI依赖的cryptography Python模块缺失导致的,根据EC2实例的操作系统,可按以下步骤修复:
Amazon Linux 2 / Amazon Linux 2023
- 更新系统包索引:
sudo yum update -y - 安装
cryptography模块(二选一即可):- 通过系统包管理器安装:
sudo yum install python3-cryptography -y - 通过pip安装:
sudo pip3 install cryptography
- 通过系统包管理器安装:
Ubuntu / Debian 系列
- 更新系统包索引:
sudo apt update -y - 安装
cryptography模块(二选一即可):- 通过系统包管理器安装:
sudo apt install python3-cryptography -y - 通过pip安装:
sudo pip3 install cryptography
- 通过系统包管理器安装:
RHEL / CentOS 7/8
- 更新系统包索引:
sudo yum update -y - 安装
cryptography模块(二选一即可):- 通过系统包管理器安装:
sudo yum install python3-cryptography -y - 通过pip安装:
sudo pip3 install cryptography
- 通过系统包管理器安装:
额外提示
如果执行pip安装时提示版本过低,先升级pip再安装:
sudo pip3 install --upgrade pip sudo pip3 install cryptography
内容的提问来源于stack exchange,提问作者DmcZx
相关产品推荐
相关产品推荐

