如何安装libpq-fe.h? [英] How to install libpq-fe.h?

查看:1492
本文介绍了如何安装libpq-fe.h?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法一生解决这个问题.

I cannot figure this out for the life of me.

当我pip install django-tenant-schemas时,它尝试安装依赖项psycopg2,该依赖项需要Python标头和gcc.我已经安装了所有这些,仍然继续收到此错误!

When I pip install django-tenant-schemas it tries to install the dependency psycopg2 which requires the Python headers and gcc. I have all this installed and still keep getting this error!

./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory

因此要安装libpq-fe-h,我需要sudo apt-get install libpq-dev ..

So to install libpq-fe-h I need to sudo apt-get install libpq-dev..

..它返回..

libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).

然后,当我sudo find / libpq-fe.h时,它似乎不在我的操作系统中.

Then when I sudo find / libpq-fe.h it doesn't seem to be in my OS.

我现在迷路了.如果有人可以提供帮助,我将不胜感激.

I am lost at this point. If anyone can help I would highly appreciate it.

推荐答案

由于某种原因,系统上缺少该文件.

For some reason, the file is missing on the system.

在使用apt-get时,系统是基于dpkg的,大概是Debian或它的派生版本.您可以尝试 Ubuntu的软件包搜索,以获取哪个软件包包含名称为后缀为 libpq-fe.h.

As you're using apt-get, the system is dpkg based, presumably Debian or it's derivative. You can try the Ubuntu's package search to get which package contains a file with name ending in libpq-fe.h.

我发现该软件包为libpq-dev,文件的绝对路径为/usr/include/postgresql/libpq-fe.h .

I found the package is libpq-dev and file's absolute path is /usr/include/postgresql/libpq-fe.h.

FWIW,在基于dpkg的系统上,如果知道文件的绝对路径,则可以检查哪个软件包提供了文件:

FWIW, on a dpkg based system, you can check which package gives a file if you know the file's absolute path:

% dpkg -S /usr/include/postgresql/libpq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h

此外,与find不同,locate保留通过cron每天创建的已找到文件(mlocate.db)的缓存;因此,如果上次运行后碰巧删除了该文件,则可以运行locate libfq-fe.h来获取文件的绝对路径,而无需在线检查Ubuntu软件包搜索.

Also, unlike find, locate keeps a cache of found files (mlocate.db) that is created everyday via cron; so if the file happens to be removed after the last run, you can run locate libfq-fe.h to get the absolute path to the file without needing to check the Ubuntu package search online.

因此包装为libpq-dev.现在,重新安装它将使所有内容恢复为默认状态,即所有相关文件都将被复制到正确的位置.由于它只是一个库程序包,因此不会覆盖任何用户/系统级配置(dpkg会提示您对执行此操作的任何程序包进行操作).

So the package is libpq-dev. Now, reinstalling it will get everything to the default state i.e. all relevant files will be copied to the right places. As it is only a library package, no user/system level configurations will be overridden (and dpkg will prompt you for action for any package that does that).

要重新安装软件包,请执行以下操作:

To reinstall the package:

sudo apt-get install --reinstall libpq-dev

这篇关于如何安装libpq-fe.h?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆