报错信息

RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

解决方案

pip install cryptography

如果还报错

确认安装情况

pip show cryptography

尝试重新安装

pip install --upgrade cryptography

如果你使用的是 MySQLMariaDB 数据库,并且需要使用 sha256_passwordcaching_sha2_password 来进行认证,你需要确保使用的是支持这些认证方法的客户端库(比如 mysql-connector-python)。

pip install mysql-connector-python

如果还遇到问题,可以清空缓存再安装

pip cache purge

pip install cryptography

Logo

一站式 AI 云服务平台

更多推荐