Error: No module named psycopg2.extensions

前端 未结 18 1991
感动是毒
感动是毒 2020-12-02 07:35

I am trying to set up a PostgreSQL database for my django project, which I believe I have done now thanks to the replies to my last question Problems setting up a postgreSQL

相关标签:
18条回答
  • The first thing to do is to install the dependencies.

    sudo apt-get build-dep python-psycopg2
    

    After that go inside your virtualenv and use

    pip install psycopg2-binary
    

    These two commands should solve the problem.

    0 讨论(0)
  • 2020-12-02 08:08
    pip install psycopg2-binary
    

    The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.

    0 讨论(0)
  • 2020-12-02 08:09

    Check if you have installed psycopg2 if not

    sudo apt-get install psycopg2
    

    Install the dependencies.

    sudo apt-get build-dep python-psycopg2
    

    These two commands should solve the problem.

    0 讨论(0)
  • 2020-12-02 08:13

    For Django 2 and python 3 install psycopg2 using pip3 :

    pip3 install psycopg2
    
    0 讨论(0)
  • 2020-12-02 08:13

    I installed it successfully using these commands:

    sudo apt-get install libpq-dev python-dev
    pip install psycopg2
    
    0 讨论(0)
  • 2020-12-02 08:14

    On Alpine Linux (majority of the docker containers) do:

    apk add postgresql-dev
    

    Then:

    pip install psycopg2-binary
    
    0 讨论(0)
提交回复
热议问题