本文主要是介绍ModuleNotFoundError: No module named ‘psycopg2‘问题及解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错如下
(venv) D:\geodj\geodjango>python manage.py makemigrations
Traceback (most recent call last):File "D:\geodj\venv\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in <module>import psycopg2 as Database
ModuleNotFoundError: No module named 'psycopg2'During handling of the above exception, another exception occurred:Traceback (most recent call last):File "manage.py", line 21, in <module>main()File "manage.py", line 17, in mainexecute_from_command_line(sys.argv)···from django.db.backends.postgresql.base import (File "D:\geodj\venv\lib\site-packages\django\db\backends\postgresql\base.py", line 29, in <module>raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'
解决方法
(venv) D:\geodj\geodjango>pip install psycopg2
Collecting psycopg2Using cached psycopg2-2.8.5-cp37-cp37m-win_amd64.whl (1.1 MB)
Installing collected packages: psycopg2
Successfully installed psycopg2-2.8.5
这篇关于ModuleNotFoundError: No module named ‘psycopg2‘问题及解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!