• Centos pip 安装uwsgi 报错“fatal error: Python.h: No such file or directory”


      flask项目写到一半,准备试着放在服务器上跑跑,一想生产环境不能用 app.run(),百度了一下要使用Ngix+uwsgi。

      本着一路pip的原则,首先来了一个漂亮的

    pip3 install uwsgi
    

      不幸报错

    [gcc -pthread] core/zlib.o
        [gcc -pthread] core/regexp.o
        [gcc -pthread] core/routing.o
        [gcc -pthread] core/yaml.o
        [gcc -pthread] core/ssl.o
        [gcc -pthread] core/legion.o
        [gcc -pthread] core/xmlconf.o
        [gcc -pthread] core/dot_h.o
        [gcc -pthread] core/config_py.o
        *** uWSGI compiling embedded plugins ***
        [gcc -pthread] plugins/python/python_plugin.o
        In file included from plugins/python/python_plugin.c:1:0:
        plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
         #include <Python.h>
                            ^
        compilation terminated.
    
        ----------------------------------------
    Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dsr9i4nq/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
    ', '
    ');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-9835ofpr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-dsr9i4nq/uwsgi/
    

      一看找不到python.h,肯定是依赖问题,网上一搜,基本答案都是安装 python-dev  和 build-essential,我试着yum了一下,发现居然没有找到包

    [root@VM_0_13_centos python3]# yum install python-dev
    Loaded plugins: fastestmirror, langpacks
    Repository epel is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    No package python-dev available.
    Error: Nothing to do
    

      想想自己是python3,换个姿势

    [root@VM_0_13_centos python3]# yum install python3-dev
    Loaded plugins: fastestmirror, langpacks
    Repository epel is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    No package python3-dev available.
    Error: Nothing to do
    [root@VM_0_13_centos python3]# yum install python34-dev
    Loaded plugins: fastestmirror, langpacks
    Repository epel is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    No package python34-dev available.
    Error: Nothing to do
    

      这就迷了

      后来无意中翻到 http://blog.csdn.net/dingqingsong/article/details/77651414 ,虽然报错不太一致,但好歹都是 找不到 <python.h>

      

    yum install python34-devel
    

      安装完后,接着pip安装uwsgi,一路顺风。

    我就是我,吃瓜的瓜
  • 相关阅读:
    Fluent UDF【1】:简介
    CFD使用者应当了解的一些事情
    关于CAE的那点儿破事儿【二】
    sau交流学习社区--看小说的lovebook一个无线端BS应用
    sau交流学习社区--songEagle开发系列:Vue.js + Koa.js项目中使用JWT认证
    mysql数据库NO CONNECTION问题分析以及解决方案
    sau交流学习社区第三方登陆github--oauth来实现用户登录
    微信小程序初体验,入门练手项目--通讯录,部署上线(二)
    快速新建简单的koa2后端服务
    docker初体验,搭建自用的gitlab服务
  • 原文地址:https://www.cnblogs.com/eating-gourd/p/8578007.html
Copyright © 2020-2023  润新知