Posts Tagged With: error install psycopg2 python3

Install psycopg2 in Linux with Python 3

It’s hard to install psycopg2 on a Linux server that running python 3.

First of all, you need to install python3-dev. The python3-dev package is required for compilation of Python 3 extensions written in C or C++, like psycopg2. If you’re running a Debian-based distribution (e.g. Ubuntu, linux mint), you can install python3-dev by running:

apt-get install python3-dev

Then you can install psycopg2 normally (here is example with a python package manager):

pip install psycopg2

If you’re using python2, you should install python-dev instead

Categories: IT | Tags: , , , | Leave a comment

Blog at