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

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

问题描述

我这辈子都搞不清楚.

当我 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 已经是最新版本(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 的包搜索 以获取哪个包包含名称​​结尾的文件em> 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).

要重新安装软件包:

sudo apt-get install --reinstall libpq-dev

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

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