开发者

PostgreSQL - pg_config -bash: pg_config: command not found

开发者 https://www.devze.com 2023-01-27 09:44 出处:网络
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:

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?

开发者_C百科

Thanks


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


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"


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.


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

brew install postgresql


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消