python3.7安装uwsgi报错Python.h: No such file or directory

多个Python环境安装uwsgi出错
环境:Ubuntu18.04、Python2.7、Python3.6、Python3.7

错误

    plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    In file included from plugins/python/python_plugin.c:1:0:
    plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    In file included from plugins/python/pyloader.c:1:0:
    plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    In file included from plugins/python/wsgi_handlers.c:1:0:
    plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2qh388t3/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2qh388t3/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-085m42nt/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/uwsgi Check the logs for full command output.

解决方法

安装对应版本的编译依赖包

apt-get install python3.7-dev

安装uwsgi

python3.7 -m pip install uwsgi -i https://pypi.douban.com/simple
root@fe39535c8ec2:/usr/include# python3.7 -m pip list
Package       Version
------------- ---------
asn1crypto    0.24.0
certifi       2020.6.20
chardet       3.0.4
cryptography  2.1.4
idna          2.6
keyring       10.6.0
keyrings.alt  3.0
pip           20.2.2
pycrypto      2.6.1
pygobject     3.26.1
pyxdg         0.25
requests      2.24.0
SecretStorage 2.3.1
setuptools    39.0.1
six           1.11.0
urllib3       1.25.10
uWSGI         2.0.19.1
wheel         0.30.0
root@fe39535c8ec2:/usr/include#
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值