Install libpq-dev package error

2019-03-16 01:10发布

问题:

I tried to install pg gem and I have had this warning:

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

So I tried install libpq-dev package and I have had this warning:

libpq-dev : Depends: libpq5 (= 8.4.17-0squeeze1) but 9.1.9-1~bpo60+1 is to be installed

How to fix this?

回答1:

This should let you install the package you need :) Just tried it myself, I am not sure you will need all the packages on the second line, try it and see :)

apt-get update
apt-get install libxslt-dev libxml2-dev libpam-dev libedit-dev
aptitude install -t squeeze-backports postgresql-server-dev-9.1


回答2:

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