pip install psycopg2報錯
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. 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'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
。。。。。。。
解決辦法(我用的是ubuntu20):
這是因為缺少一個依賴包libpq-dev:
執行 sudo apt-get install libpq-dev
依賴包安裝成功之後再次執行pip install psycopg2即可
參考部落格 https://www.cnblogs.com/iminic/p/4092918.html