执行 python manage.py makemigrations
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods
原因是Python环境中缺少cryptography包,是MySQL连接中用于sha256_password或caching_sha2_password这两种身份验证方法所必需的。
一、
黑窗口或其他连接工具手动连接一次数据库再次执行命令项目就运行成功了
当然不可能每次都手动连接一次[呲牙],那就使用方法二
二、
使用命令下载cryptography包
————————————————
pip install cryptography
安装完后再次连接或重启项目文件后,连接成功
由于网络原因,可能会超时:
Downloading cryptography-43.0.1-cp39-abi3-macosx_10_9_universal2.whl (6.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/6.2 MB ? eta -:--:--
ERROR: Exception: timeout
使用下面方案解决
指定清华源下载
pip install cryptography -i https://pypi.tuna.tsinghua.edu.cn/simple
安装成功后执行启动项目命令
Successfully installed cffi-1.17.1 cryptography-43.0.1 pycparser-2.22

4012

被折叠的 条评论
为什么被折叠?



