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 1009
半阙折子戏
半阙折子戏 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条回答
  •  甜味超标
    2020-12-22 18:06

    They changed the packaging for psycopg2. Installing the binary version fixed this issue for me. The above answers still hold up if you want to compile the binary yourself.

    See http://initd.org/psycopg/docs/news.html#what-s-new-in-psycopg-2-8.

    Binary packages no longer installed by default. The ‘psycopg2-binary’ package must be used explicitly.

    And http://initd.org/psycopg/docs/install.html#binary-install-from-pypi

    So if you don't need to compile your own binary, use:

    pip install psycopg2-binary
    

提交回复
热议问题