PostgreSQL - pg_config -bash: pg_config: command n

2019-04-18 16:56发布

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

5条回答
迷人小祖宗
2楼-- · 2019-04-18 17:16

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"
查看更多
成全新的幸福
3楼-- · 2019-04-18 17:16

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.

查看更多
放我归山
4楼-- · 2019-04-18 17:19

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

查看更多
再贱就再见
5楼-- · 2019-04-18 17:28

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

查看更多
SAY GOODBYE
6楼-- · 2019-04-18 17:28

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

查看更多
登录 后发表回答