Psycopg2 fails to install on python 3 with pip issuing a fatal error

前端 未结 4 1676
猫巷女王i
猫巷女王i 2020-12-19 15:39
$ yum install python3 postgresql python-devel libpqxx-devel
Loaded plugins: langpacks, refresh-packagekit
Package python3-3.3.2-8.fc20.x86_64 already installed and l         


        
相关标签:
4条回答
  • 2020-12-19 16:20

    Install the python3-devel package to get it work

    sudo dnf install python3-devel
    

    If it works then alright or if it requires libpq-fe.h file then install it using the command:

    sudo dnf install postgresql-devel
    
    0 讨论(0)
  • 2020-12-19 16:21

    On Ubuntu. I solved this with:

    sudo apt-get install libpq-dev
    
    0 讨论(0)
  • 2020-12-19 16:26

    You are missing python3 include files

    ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory
    

    you can probably find them in the python3-devel package.

    0 讨论(0)
  • 2020-12-19 16:29

    As indicated in the other answers this is caused by not having the right Python "devel" package installed. On CentOS, the Python "devel" rpm package is numbered with the with the qualified version. For example as of this writing the current versions are:

    python34-devel for epel repository

    python36u-devel for ius repository

    Example Yum command (assumes EPEL repository is configured):

    sudo yum install python34-devel

    Related answer from server fault: https://serverfault.com/questions/710354/repository-for-python3-devel-on-centos-7

    0 讨论(0)
提交回复
热议问题