[尝试在ubuntu 18.04上使用pip安装uwsgi时遇到以下错误:
$ sudo pip3 install uwsgi
...
plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
我已经安装了python-dev
和python3-dev
软件包。运行locate Python.h
显示它确实已安装:
/usr/include/python2.7/Python.h
/usr/include/python3.6m/Python.h
我尝试同时使用pip
和pip3
进行安装,但出现相同的错误。该问题的所有其他答案都指向已安装python-dev
或python3-dev
或某些变体,而我已经尝试了所有这些方法。还有其他想法可能导致此问题吗?
这是我从3.6
升级到3.7
后今天遇到的相同问题。
通过安装libpython3.7-dev
解决此问题:sudo apt install libpython3.7-dev
/ libpython3.*-dev
您使用哪个版本。
然后再次安装uwsgi
:pip install uwsgi
输出应类似于:
Building wheels for collected packages: uwsgi
Running setup.py bdist_wheel for uwsgi ... done
Stored in directory: /home/user/.cache/pip/wheels/2d/0c/b0/f3ba1bbce35c3766c9dac8c3d15d5431cac57e7a8c4111c268
Successfully built uwsgi
Installing collected packages: uwsgi, weasyprint
Successfully installed uwsgi-2.0.18 weasyprint-50
希望获得帮助。