![](/img/trans.png)
[英]Error installing uwsgi with pip: "Python.h no such file". python-dev and python3-dev packages are installed
[英]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.