多个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#
版权声明:本文为llf_cloud原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。