啊啊,ERROR。
上一次安裝PostgreSQL是汰換Win 7筆電之前,這次在Mac OS安裝Postgres.app,然後要安裝psycopg2的時候報錯了。
傻眼,我有些急用啊,你大哥請支援收銀好嗎?
shell
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):
shell
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH" pip install psycopg2
Note
- \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;)