1

When I try to install psycopg2 the error appears

fatal error: Python.h: No such file or directory
      #include <Python.h>

Because, there is a search for this file along the path /usr/include/python3.8

But this file is located in the path /usr/local/include/python3.8/Python.x

How to solve this problem?? Is Python installed in the wrong directory?

0

1 Answer 1

2

Its not clear what version of Ubuntu you are using. Assuming it is a fresh install and you don't have these installed. I would suggest you install the following

sudo apt-get install python3 python-dev python3-dev build-essential

Once these are installed then try again installing psycopg2

Sign up to request clarification or add additional context in comments.

4 Comments

I have it, the problem is not in it, I indicated that Python.h is there, but psycopg2 looks for it in a different directory. Version 18.04
are you using virtual environment?
Yes i do use it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.