使用pip安装uwsgi时出错:“ Python.h无此类文件”。已安装python-dev和python3-dev软件包

问题描述 投票:0回答:1

[尝试在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-devpython3-dev软件包。运行locate Python.h显示它确实已安装:

/usr/include/python2.7/Python.h
/usr/include/python3.6m/Python.h

我尝试同时使用pippip3进行安装,但出现相同的错误。该问题的所有其他答案都指向已安装python-devpython3-dev或某些变体,而我已经尝试了所有这些方法。还有其他想法可能导致此问题吗?

python pip uwsgi
1个回答
0
投票

这是我从3.6升级到3.7后今天遇到的相同问题。

通过安装libpython3.7-dev解决此问题:sudo apt install libpython3.7-dev/ libpython3.*-dev您使用哪个版本。

然后再次安装uwsgipip 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

希望获得帮助。

© www.soinside.com 2019 - 2024. All rights reserved.