我目前正在尝试安装libpq-dev来安装psycopg2。问题是,当我试图安装它时,会出现一个错误,说明我没有最新的libpq5版本。然而,当我尝试下载更新版本的libpq5时,系统说我已经有了最新的版本。错误的一个例子。
lhmendes@lhmendes-GA-78LMT-S2P:~$ sudo apt-get install libpq-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libpq-dev : Depends: libpq5 (= 12.4-0ubuntu0.20.04.1) but 12.4-1.pgdg20.04+1 is to be installed
E: Unable to correct problems, you have held broken packages.
lhmendes@lhmendes-GA-78LMT-S2P:~$ sudo apt-get install libpq5
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpq5 is already the newest version (12.4-1.pgdg20.04+1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
发布于 2020-09-08 00:24:06
我想说您已经安装了最新的libpq
(12.4-1
),但是libpq-dev
需要更老的版本(12.4-0
),这就产生了问题。
您可以尝试安装旧的libpq
。
apt-get install libpq==12.4-0ubuntu0.20.04.1
但是,如果其他程序使用的是最新版本,那么旧版本可能会给这个程序带来问题。
pgdg20
in 12.4-1.pgdg20.04+1
意味着它不是来自标准ubuntu
回购的模块,而是来自其他回购--可能是postgresql
回购--也许这个回购还有最新版本的libpq-dev
。你可以在Google中搜索12.4-1.pgdg20.04+1
,也许你也可以在12.4-1.pgdg20.04+1
中找到libpg-dev
。
我找到了libpq-dev 12.4-1.pgdg20.04+1,您可以下载.deb
文件并安装它。
或者您可以添加此postgresql回购并使用apt-get
进行安装。此方法还将通知更新,然后您可以自动安装更新。
发布于 2022-01-26 18:40:59
截至2022年11月底,指挥部是:
sudo apt-get install libpq5=12.12-0ubuntu0.20.04.1 && sudo apt-get install libpq-dev
当您使用Ubuntu22.04时,请尝试:
sudo apt-get install libpq5=14.5-0ubuntu0.22.04.1 && sudo apt-get install libpq-dev
发布于 2020-12-11 02:12:17
任何较新版本的libpq5都会导致此错误。在我的例子中,它是libpq5 5=13.1-1.pgdg20.04+1。这与furus给出的答案相似,但变化是在ubuntu20.04中是libpq5(至少在我的例子中)。我通过安装来解决这个问题
sudo apt-get install libpq5=12.5-0ubuntu0.20.04.1
然后再次安装liqpq-dev。
sudo apt-get install libpq-dev
https://stackoverflow.com/questions/63785462
复制相似问题