繁体   English   中英

python.h 在安装了 python-dev 的 Ubuntu 18 上丢失

[英]python.h missing on Ubuntu 18 with python-dev installed

尝试让 fHDHR 工作 Ubuntu 18. 在安装过程中出现此错误:

include/python3.8 -c src/gevent/libev/corecext.c -o build/temp.linux-x86_64-3.8/src/gevent/libev/corecext.o
  src/gevent/libev/corecext.c:95:10: fatal error: Python.h: No such file or directory
   #include "Python.h"
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for gevent

我找到的大多数答案都告诉我我需要安装 python-dev 但它已经安装(并已更新)。 这篇文章中,建议sudo pip install mmh3我试过了,但它也失败了,因为无法找到 python.h

知道我的系统缺少什么吗?

您需要按照此处的说明安装 python3.x-dev。 对我来说,这解决了这个问题。

由于从错误行中我们可以看到您正在运行python3.8 ,因此对于您的情况,您需要执行以下操作:

sudo apt-get install python3.8-dev

你可以尝试安装python3-dev。

apt install python3-dev 

因为你使用的是 python3

当您遇到此错误时,只需在安装 package 之前进行这些安装。

对于python 2.x使用:

sudo apt-get install python-dev

对于python 2.7使用:

sudo apt-get install libffi-dev

对于python 3.x使用:

sudo apt-get install python3-dev

或对于 Python 3 的特定版本,将 x 替换为中的次要版本

sudo apt-get install python3.x-dev

查看您当前的 python 版本,即python --version ,也许您使用的是 python 2.x,如果为真:

你必须打开 Python 3

update-alternatives --install /usr/bin/python python /usr/bin/python3.x 2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM