trouble with python manage.py migrate -> No module named psycopg2

前端 未结 3 861
慢半拍i
慢半拍i 2021-01-19 06:25

I am having some trouble with migrating Django using postgresql.

This is my first time with Django, and I am just following the tutorial.

As suggested on the

3条回答
  •  执念已碎
    2021-01-19 07:10

    It must be because you are installing psycopg2 in your system level python installation not in your virtualenv.

    sudo apt-get install python-psycopg2
    

    will install it in your system level python installation.

    You can install it in your virtualenv by

    pip install psycopg2
    

    after activating your virtualenv or you can create your virtualenv with --system-site-packages flag so that your virtualenv will have packages in your system level python already available.

    virtualenv --system-site-packages test
    

    where test is your virtualenv.

提交回复
热议问题