Mac OS Xにlibpq-devをインストールする 質問する

Mac OS Xにlibpq-devをインストールする 質問する

ローカル Mac OS X で Postgresql バックエンドを使用して Django を実行しようとしています。pip を使用して Django をインストールしました。

sudo pip install Django

バイナリインストーラーの1つを使用してPostgresqlをインストールしましたここ

しかし、psycopg2 をインストールしようとすると、pg_config が見つからないというエラー (以下に貼り付け) が表示されます。

からこの質問インストールする必要があるようですlibpq-devが、方法がわかりません。

MacPorts でインストールを試みましたlibpqxxが、何も起こりませんでした。

libpg-dev をインストールするにはどうすればいいですか? それとも他に何か足りないものがあるのでしょうか?

henrietta:~ $ pip install psycopg2
Downloading/unpacking psycopg2
  Downloading psycopg2-2.4.5.tar.gz (719Kb): 719Kb downloaded
  Running setup.py egg_info for package psycopg2
    Error: pg_config executable not found.

    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.
    Complete output from command python setup.py egg_info:
    running egg_info

creating pip-egg-info/psycopg2.egg-info

writing pip-egg-info/psycopg2.egg-info/PKG-INFO

writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt

writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found

Error: pg_config executable not found.



Please add the directory containing pg_config to the PATH

or specify the full executable path with the option:



    python setup.py build_ext --pg-config /path/to/pg_config build ...



or with the pg_config option in 'setup.cfg'.

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/thomas/.pip/pip.log

ベストアンサー1

OSX 10.9.2 Mavericks の場合、これがうまくいきました。まずは brew を使って postgres をインストールしてみてください:

brew install postgresql

次にpgをインストールします

gem install pg

おすすめ記事