安装报错fatal error: Python.h: No such file or directory解决

报错信息
aiohttp/_websocket.c:6:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4pzq5z2m/aiohttp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-p7pod210-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-4pzq5z2m/aiohttp/
解决方法
  • ubuntu
sudo apt-get install python3-dev
sudo apt-get install libevent-dev
  • redhat
sudo yum install python3-devel
sudo yum install libevent-devel

你可能感兴趣的:(python)