centos 无法安装psycopg 2-二进制文件

jfewjypa  于 2022-11-08  发布在  其他
关注(0)|答案(1)|浏览(411)

我尝试在Centos 7上的Django项目的虚拟环境中安装psycopg 2-binary(pip 3 install psycopg 2-binary),并预先安装了Postgresql 12,但出现了众所周知的错误:

Error: pg_config executable not found.

    pg_config is required to build psycopg2 from source.  Please add the directory
    containing pg_config to the $PATH or specify the full executable path with the
    option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.

    If you prefer to avoid building psycopg2 from source, please install the PyPI
    'psycopg2-binary' package instead.

我尝试安装python3-devel postgresql-libs postgresql-server postgresql-devel postgresql-contrib,但仍然有这个错误。
pip 3安装psycopg 2,pip安装psycopg 2-同样的问题。
PS通过更新pip(pip安装--升级pip)解决了问题。

nxagd54h

nxagd54h1#

你可以试试这个方法,很有用

sudo apt-get install postgresql postgresql-dev python-dev

相关问题