Djangoでpostgresqlを使用しようとしていますプロジェクトなので、psycopg2をインストールしようとしましたが、問題が発生し続けています。私はvirtualenvを使用しているので、macportsを介してpsycopg2をインストールしても役に立たない。仮想env内でアプリとしてインストールする方法を見つける必要がある。
これは、virtualenvにpipインストールしようとすると表示されるエラーです。
Downloading/unpacking psycopg2
Downloading psycopg2-2.5.4.tar.gz (682kB): 682kB downloaded
Running setup.py (path:/Users/adfelix2/Documents/Hindsait_Work/Projects/nybc_pilot/build/psycopg2/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".
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/user/"privateinfo"/my_virtualenv/build/psycopg2
Storing debug log for failure in /Users/user/.pip/pip.log
ディレクトリをpg_configに追加する必要があるようです。 しかし、私はそうするのに役立つオンラインに出くわすことができません。誰かがこれに答えてくれるなら、段階的に、喜んで感謝します。ありがとうございました。
回答:
回答№1は5pg_config
に配置する必要があります
/Library/PostgreSQL/9.3/bin/pg_config
(9.3用にインストールしたPostgresのバージョンを置き換えます)
そのディレクトリを追加するだけです PATH
環境変数とあなたは前進することができるはずです。
回答№2のための5
このようなエラーを実行する場合、2つのパッケージをインストールする必要があります。
sudo apt-get install libpq-dev python-dev
psycopg2をインストールします
pip install psycopg2
回答№3の4
Postgresをインストールした場合。Macのメニューバーにあるアプリは、アプリバンドルのpg_config実行可能ファイルにパスを指定する必要があります。にアクセスして実行可能ファイルに移動できます
/Applications/Postgres.app/Contents/Versions/9.3/bin
バージョンは、インストールしたものによって異なります。これを.bash_profileの$ PATH変数に追加し、リロードして、できあがり!
回答№4の場合は1
ターミナルでこれを実行して、 pg_config
実行可能ファイル
which pg_config
postgresのインストール方法に応じて、これらのいずれかに似たパスを取得する必要があります
/Library/PostgreSQL/9.3/bin/pg_config
または
/usr/local/bin/pg_config
を保持するディレクトリを追加します pg_config
このようなあなたのPATH環境変数に実行可能
export PATH="/Library/PostgreSQL/9.3/bin:$PATH"
または
export PATH="/usr/local/bin:$PATH"
コマンドが which pg_config
何も返さない場合は、最初に実行してpostgresをインストールする必要があります
brew install postgres
次に、上記の手順を繰り返します。