[英]python.h missing on Ubuntu 18 with python-dev installed
Trying to get fHDHR working Ubuntu 18. During the install I get this error:尝试让 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
Most answers I find tell me I need python-dev installed but it already is (and updated).我找到的大多数答案都告诉我我需要安装 python-dev 但它已经安装(并已更新)。 In this post it was recommended to sudo pip install mmh3
which I tried but it also failed as unable to find python.h在这篇文章中,建议sudo pip install mmh3
我试过了,但它也失败了,因为无法找到 python.h
Any idea what I am missing on my system?知道我的系统缺少什么吗?
You need to install python3.x-dev as explained here .您需要按照此处的说明安装 python3.x-dev。 For me this resolved the issue.对我来说,这解决了这个问题。
Since from the error line we can see that you are running python3.8
, so for your case you would need to do:由于从错误行中我们可以看到您正在运行python3.8
,因此对于您的情况,您需要执行以下操作:
sudo apt-get install python3.8-dev
You can try to install python3-dev.你可以尝试安装python3-dev。
apt install python3-dev
since you are using python3因为你使用的是 python3
When you are facing this error just do these install before installation package.当您遇到此错误时,只需在安装 package 之前进行这些安装。
For python 2.x use:对于python 2.x使用:
sudo apt-get install python-dev
For python 2.7 use:对于python 2.7使用:
sudo apt-get install libffi-dev
For python 3.x use:对于python 3.x使用:
sudo apt-get install python3-dev
or for a specific version of Python 3, replace x with the minor version in或对于 Python 3 的特定版本,将 x 替换为中的次要版本
sudo apt-get install python3.x-dev
Look at your current python version, ie, python --version , perhaps you're on python 2.x, if True:查看您当前的 python 版本,即python --version ,也许您使用的是 python 2.x,如果为真:
You have to switch on Python 3你必须打开 Python 3
update-alternatives --install /usr/bin/python python /usr/bin/python3.x 2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.