美文网首页遇到过的问题我爱编程
pip安装时报【fatal error: Python.h: N

pip安装时报【fatal error: Python.h: N

作者: pinkong | 来源:发表于2018-05-28 22:47 被阅读0次

    用pip安装第三方包的时候,有时候会遇到fatal error: Python.h: No such file or directory compilation terminated这样的报错。因为这些库使用了c扩展,需要编译,然后又找不到头文件和静态库导致的。编译这些c库需要的依赖库由python dev提供,安装即可:

    For apt (Ubuntu, Debian...):

    sudo apt-get install python-dev   # for python2.x installs
    sudo apt-get install python3-dev  # for python3.x installs
    

    For yum (CentOS, RHEL...):

    sudo yum install python-devel   # for python2.x installs
    sudo yum install python34-devel   # for python3.4 installs
    

    For dnf (Fedora...):

    sudo dnf install python2-devel  # for python2.x installs
    sudo dnf install python3-devel  # for python3.x installs
    

    For zypper (openSUSE...):

    sudo zypper in python-devel   # for python2.x installs
    sudo zypper in python3-devel  # for python3.x installs
    

    相关文章

      网友评论

        本文标题:pip安装时报【fatal error: Python.h: N

        本文链接:https://www.haomeiwen.com/subject/thbnjftx.html