You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application

后端 未结 9 1005
半阙折子戏
半阙折子戏 2020-12-22 17:10

I am working on Django project with virtualenv and connect it to local postgres database. when i run the project is says,

ImportError: No module named psycop         


        
9条回答
  •  旧时难觅i
    2020-12-22 18:01

    I was using a virtual environment on Ubuntu 18.04, and since I only wanted to install it as a client, I only had to do:

    sudo apt install libpq-dev
    pip install psycopg2
    

    And installed without problems. Of course, you can use the binary as other answers said, but I preferred this solution since it was stated in a requirements.txt file.

提交回复
热议问题