PostgreSQL database adapter for the Python programming language. Its main features are the complete implementation of the Python DB API 2.0 specification and the thread safety (several threads can share the same connection). It was designed for heavily multi-threaded applications that create and destroy lots of cursors and make a large number of concurrent “INSERT”s or “UPDATE”s.
下载psycopg2 下来,解压,到其所在文件目录下执行
sudo python setup.py install
(在你已经安装 Homebrew 的前提下)
brew install postgresql
我的是:/usr/local/Cellar/postgresql/9.4.4/bin
具体的“9.4.4”根据自己的版本号来。
这里我添加下面的内容到我的 .bash_profile 文件
export PATH=/usr/local/Cellar/postgresql/9.4.4/bin:$PATH
第一种方法:按文章开头:“ 1安装[psycopg2] ”进行安装
第二种方法:已经安装过pip的,执行下面的命令
pip install psycopg2
3.1的整个过程经过我的实际验证,成功!
which pg_config
export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
pip install psycopg2
安装 postgresql-devel:
sudo yum install postgresql-devel
pg_config 文件在 postgresql-devel package中,然后进行path配置。
附参考文章:
stackoverflow 的讨论:Error: pg_config executable not found
其他参考解决方案:Resolving Error: pg_config executable not found on Mac