【发布时间】:2020-09-07 23:48:05
【问题描述】:
我目前正在尝试安装 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.
【问题讨论】:
-
我会说你已经安装了最新的
libpq(12.4-1) 但libpq-dev需要旧版本 (12.4-0) 这会产生问题。您可以尝试安装较旧的libpq-apt-get install libpq==12.4-0ubuntu0.20.04.1但如果其他程序使用最新版本,则较旧版本可能会出现问题。奇怪的是pgdg20in12.4-1.pgdg20.04+1,因为它不是来自标准 ubuntu repo 的模块,而是来自其他一些 repo - 也许这个 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 repo 并使用apt-get安装 -
嗨!尝试从
.deb安装 libpq-dev 12.4-1.pgdg20.04+1 但发生了同样的错误。说我没有一些需要的依赖项。编辑:链接发送到页面下载libpq-dev 12.4-1.pgdg18.04+1。刚刚下载了 20.04 并且工作正常!非常感谢!
标签: python python-3.x psycopg2 libpqxx