美文网首页
centos7下python3.6安装uwsgi失败的解决方法

centos7下python3.6安装uwsgi失败的解决方法

作者: 喜叔z | 来源:发表于2021-05-01 12:48 被阅读0次

    centos7下python3.6安装uwsgi失败的解决方法

    报错信息(省略大部分):

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
    #include <Python.h></pre>

    原因:必须同时安装“编译工具”和“python-devel”,才能成功安装uwsgi

    解决方法:

    1.安装编译工具

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">yum install -y gcc* pcre-devel openssl-devel</pre>

    2.安装python-devel(重要)

    这一步跟着网上很多步骤走,但是都出错了。可能是版本不同的原因,下面是我总结的方法:

    首先yum搜索python-devel

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">yum search python-devel</pre>

    搜索到了

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">python-devel.x86_64 : The libraries and header files needed for Python development</pre>

    安装下来后发现是python2.7版本的。然而需要安装的是3.6版本的。

    用如下命令搜索3.6版本:

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">yum search python36-devel</pre>

    搜索到了:

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">python36-devel.x86_64 : Libraries and header files needed for Python development</pre>

    是需要的版本,然后安装:

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">yum install python36-devel.x86_64</pre>

    3.最后安装uwsgi:

    <pre style="margin: 0px; padding: 0px; overflow: auto; overflow-wrap: break-word; font-family: inherit !important; font-size: 12px !important; color: rgb(101, 108, 115);">pip install uwsgi</pre>

    成功!

    相关文章

      网友评论

          本文标题:centos7下python3.6安装uwsgi失败的解决方法

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