在ubuntu server 或 raspberry pi安裝psycopg2的錯誤訊息
Error: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-v5ZnhD/psycopg2 如果一直出現以上的psycopg2要執行以下的指令 sudo pip install --upgrade setuptools sudo apt-get install python-psycopg2 sudo apt-get install libpq-dev 再裝psycopg2 pip install psycopg2 ***************************************** In file included from psycopg/psycopgmodule.c:27:0: ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 如果一直出現以上的錯誤要執行以下的指令 sudo apt-get install python-dev 再裝psycopg2 pip install psycopg2 參考 參考