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 998
半阙折子戏
半阙折子戏 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

    You must setup postgresql-server-dev-X.Y, where X.Y. your's servers version, and it will install libpq-dev and other servers variables at modules for server side developing. In my case it was

    apt-get install postgresql-server-dev-9.5
    

    Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libmysqlclient18 mysql-common Use 'apt-get autoremove' to remove them. The following extra packages will be installed:
    libpq-dev Suggested packages: postgresql-doc-10 The following NEW packages will be installed: libpq-dev postgresql-server-dev-9.5

    In your's case

    sudo apt-get install postgresql-server-dev-X.Y
    sudo apt-get install python-psycopg2
    

提交回复
热议问题