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

发布于 2024-10-05 11:21:29 字数 211 浏览 5 评论 0原文

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

PostgreSQL 工作正常,但在命令行中出现以下错误:

$ pg_config
-bash: pg_config: command not found

有人知道如何获取此设置以便我可以运行 pg_config?

谢谢

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

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

$ pg_config
-bash: pg_config: command not found

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

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

偏爱自由 2024-10-12 11:21:29

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

yum install postgresql-devel

起作用

或用于

yum provides "*/pg_config"

获取确切的包

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

yum install postgresql-devel

will work

or use

yum provides "*/pg_config"

to get the exact package

小猫一只 2024-10-12 11:21:29

除了安装 postgresql-devel 之外,我还必须修改 PATH 环境变量。例如,将其添加到您的 .bashrc 中:

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

In addition to installing postgresql-devel I had to modify the PATH environment variable. E.g. add this to your .bashrc:

export PATH="$PATH:/usr/pgsql-9.4/bin"
℉服软 2024-10-12 11:21:29

我的问题是 pg_config 不在路径中。因此,我首先需要使用搜索 pg_config 的路径。

yum provides "*/pg_config"

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

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

,成功安装了 pg。系统是CentOS。

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

yum provides "*/pg_config"

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

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

That installed pg successfully. The system was a CentOS.

物价感观 2024-10-12 11:21:29

pg_config 是一个 PostgreSQL 实用程序,您可以通过安装 PostgreSQL 来获取它。
在苹果电脑上:

brew install postgresql

pg_config is a PostgreSQL util, you can get it by installing PostgreSQL.
On mac:

brew install postgresql
苏佲洛 2024-10-12 11:21:29

查找 pg_config 所在位置:find / -name pg_config 2>/dev/null
复制路径,然后执行:export PATH=/usr/local/pgsql/bin:$PATH。确保使用正确的复制路径。

Find where pg_config is located: find / -name pg_config 2>/dev/null
Copy the path then do: export PATH=/usr/local/pgsql/bin:$PATH. Make sure to use your correct copied path.

煮茶煮酒煮时光 2024-10-12 11:21:29

pg_config 附带 PostgreSQL 的开发文件。转到您获取服务器守护程序的位置并在那里查找它们。

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

心的位置 2024-10-12 11:21:29

我有一个带有 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

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

yum provides "*/pg_config"

我得到一个列表,我们可以在其中找到

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

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

yum provides "*/pg_config"

你需要为你的架构安装正确的版本(32位或64位),在我的例子中是:

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

然后更新

yum update

并最终使用 pip

pip install psycopg2 安装 psycopg2

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:

# 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_config
Later i do :

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:

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

then update

yum update

and finally install psycopg2 with pip

pip install psycopg2

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文