我目前正在尝试安装 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.
原文由 lhmmendes 发布,翻译遵循 CC BY-SA 4.0 许可协议
I would say you have installed the latest
libpq
(12.4-1
) butlibpq-dev
needs older version (12.4-0
) and this makes problem.您可以尝试安装旧的
libpq
但如果其他程序使用最新版本,则旧版本可能会使该程序出现问题。
pgdg20
in12.4-1.pgdg20.04+1
means it is not module from standardubuntu
repo but from some other repo - probablypostgresql
repo - and maybe this repo还有最新版本libpq-dev
。您将在 Google 中搜索12.4-1.pgdg20.04+1
,也许您还可以找到libpg-dev
和12.4-1.pgdg20.04+1
我找到了 libpq-dev 12.4-1.pgdg20.04+1 ,你可以下载
.deb
文件并安装它。或者您可以添加此 postgresql 存储库并使用
apt-get
安装。此方法还将通知更新,然后您可以自动安装更新。