本部落格已搬遷, 3秒後跳轉...

Python:install psycopg2 error | Laplace's Lab

Python:install psycopg2 error

啊啊,ERROR。

上一次安裝PostgreSQL是汰換Win 7筆電之前,這次在Mac OS安裝Postgres.app,然後要安裝psycopg2的時候報錯了。

傻眼,我有些急用啊,你大哥請支援收銀好嗎?

1
2
3
4
5
6
7
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH

(omitted...)

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

pip報錯說找不到pg_config路徑,要把Postgress.app的bin資料夾路徑加入環境變數,參考stackoverflow上的討論,於安裝時指定其路徑(Mac OS):

1
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH" pip install psycopg2

Note


Psql Commonly used commands

\list: list databases
\dt : list tables in current DB
\d TABLE_NAME : list table columns
\x : enable expanded display (e.g. SELECT * FROM mytable LIMIT 10;)

0%