PostgreSQL - pg_config -bash: pg_config: 命令未找到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4293111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 19:54:12  来源:igfitidea点击:

PostgreSQL - pg_config -bash: pg_config: command not found

bashunixpostgresqlshellpath

提问by AnApprentice

I'm on a Mac building an app in Rails 3 with PostgreSQL...

我在 Mac 上使用 PostgreSQL 在 Rails 3 中构建应用程序......

PostgreSQL is working fine but in the command line I get the following error:

PostgreSQL 工作正常,但在命令行中我收到以下错误:

$ pg_config
-bash: pg_config: command not found

Anyone know how to get this setup so I can run pg_config?

任何人都知道如何获得此设置以便我可以运行 pg_config?

Thanks

谢谢

回答by Unni

you can install postgresql-devel to get that. in rpm based distro

你可以安装 postgresql-devel 来获得它。在基于 rpm 的发行版中

yum install postgresql-devel

will work

将工作

or use

或使用

yum provides "*/pg_config"

to get the exact package

得到确切的包裹

回答by dimid

In addition to installing postgresql-develI had to modify the PATHenvironment variable. E.g. add this to your .bashrc:

除了安装postgresql-devel我不得不修改PATH环境变量。例如,将此添加到您的.bashrc

export PATH="$PATH:/usr/pgsql-9.4/bin"

回答by Anwar

My problem was that pg_configwas not in the PATH. So, I first needed to search for pg_config's path by using

我的问题是pg_config不在 PATH 中。所以,我首先需要pg_config使用

yum provides "*/pg_config"

After noting the path, I used this command to install pg gem

记下路径后,我使用此命令安装 pg gem

gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config

That installed pgsuccessfully. The system was a CentOS.

那安装pg成功了。该系统是一个 CentOS。

回答by Ignacio Vazquez-Abrams

pg_configcomes with the development files for PostgreSQL. Go to where you got the server daemon from and look for them there.

pg_config附带 PostgreSQL 的开发文件。转到您从哪里获得服务器守护程序并在那里寻找它们。

回答by Paul Giancarlo Diaz

i have a CentOS 5.11 with postgres 9.0, and python 2.4 , python 2.6 to run openERP 6, trying to install the psycopg2 i allways get the error:

我有一个带有 postgres 9.0 的 CentOS 5.11 和 python 2.4 ,python 2.6 来运行 openERP 6,尝试安装 psycopg2 我总是得到错误:

# python26 setup.py install --with-xslt-config=/usr/local/bin/xslt-config --with-xml2-config=/usr/local/bin/xml2-config
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --with-xslt-config not recognized

from :how to install pg_configLater i do :

来自:如何安装 pg_config后来我做:

yum provides "*/pg_config"

i get a list, where we can find

我得到一个清单,我们可以在那里找到

postgresql84-devel-8.4.20-1.el5_10.x86_64 : PostgreSQL development header     files
                                          : and libraries
Repo        : base
Matched from:
Filename    : /usr/bin/pg_config

but if i try to install, its already installed So i use

但是如果我尝试安装,它已经安装了所以我使用

yum provides "*/pg_config"

later you need install the rigth vertion, for your architecture(32bit or 64bit), in my case was:

稍后您需要为您的架构(32 位或 64 位)安装 rigth 版本,在我的情况下是:

yum install postgresql84-devel-8.4.20-1.el5_10.x86_64

then update

然后更新

yum update

and finally install psycopg2 with pip

最后用pip安装psycopg2

pip install psycopg2

pip 安装 psycopg2