无法在 python3 上安装 psycopg2

unable to install psycopg2 on python3

提问人:Matias 提问时间:4/27/2021 更新时间:4/27/2021 访问量:1268

问:

我正在尝试在 CentOS Linux 7 上的 python3 上安装 psycopg2 模块并收到以下错误

In file included from psycopg/psycopgmodule.c:28:0:
./psycopg/psycopg.h:36:22: fatal error: libpq-fe.h: No such file or directory
 #include <libpq-fe.h>
                      ^
compilation terminated.

It appears you are missing some prerequisite to build the package from source.

You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.

For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).

error: command 'gcc' failed with exit status 1

关于解决方案的任何想法?

谢谢

python 安装 psycopg2

评论

3赞 gold_cy 4/27/2021
psycopg.org/docs/install.html 您没有构建要求,那么只需按照我链接的文档中的说明安装轮子即可
0赞 Matias 4/27/2021
像魅力一样工作!不过我不得不做 pip3,我想 pip 是针对 python 2.7 的

答: 暂无答案