Django迁移报错ModuleNotFoundError: No module named ‘captcha‘

遇到问题

IDE为Pycharm,安装过captcha包,在settings中将‘captcha’注册到app列表里,然后再Terminal中进行迁移:

python manage.py migrate

结果报错:

ModuleNotFoundError: No module named 'captcha'

解决方法

在Anaconda中激活虚拟环境,cd到manage.py路径,再进行迁移即可成功

Operations to perform:
  Apply all migrations: admin, auth, captcha, contenttypes, login, sessions
Running migrations:
  Applying captcha.0001_initial... OK
  Applying captcha.0002_alter_captchastore_id... OK

有没有人可以解释一下这个问题的原因...

猜你喜欢

转载自blog.csdn.net/Calistar/article/details/132720775