psycopg: Python.h: No such file or directory

后端 未结 4 1470
野性不改
野性不改 2021-01-07 16:34

I\'m compiling psycopg2 and get the following error: Python.h: No such file or directory

How to compile it, Ubuntu12 x64.

4条回答
  •  我在风中等你
    2021-01-07 16:55

    As mentioned in psycopg documentation http://initd.org/psycopg/docs/install.html

    Psycopg is a C wrapper around the libpq PostgreSQL client library. To install it from sources you will need:

    • C compiler
    • Python header files

    They are usually installed in a package such as python-dev a message error such: Python.h: no such file or directory indicate that you missed mentioned python headers.

    How you can fix it? First of all you need check which python version installed in your virtual envitonment or in system itself if you didnt use virtual environment. You can check your python version by:

    python --version 
    

    After it you should install the same python-dev version which installed on your virtual env or system. For example if you use python3.7 you should install

    apt-get install python3.7-dev 
    

    Hope my answer will help anyone

提交回复
热议问题