在 Ubuntu 20.04 上使用 Pip 安装 pandas_profiling 时出错

Error installing pandas_profiling with Pip on Ubuntu 20.04

pip install pandas_profiling

失败于

Running setup.py install for Bottleneck ... error ERROR: Command errored out with exit status 1: command: /home/me/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u7f_8_0k/bottleneck_1375337c49c246109b2e650965628211/setup.py'"'"'; file='"'"'/tmp/pip-install-u7f_8_0k/bottleneck_1375337c49c246109b2e650965628211/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-pgrmqqqd/install-record.txt --single-version-externally-managed --compile --install-headers /home/me/venv/include/site/python3.9/Bottleneck cwd: /tmp/pip-install-u7f_8_0k/bottleneck_1375337c49c246109b2e650965628211/ Complete output (15 lines): running install running build running build_py running build_ext building 'bottleneck.reduce' extension creating build/temp.linux-x86_64-3.9 creating build/temp.linux-x86_64-3.9/bottleneck creating build/temp.linux-x86_64-3.9/bottleneck/src x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/me/venv/lib/python3.9/site-packages/numpy/core/include -I/home/me/venv/include -I/usr/include/python3.9 -c bottleneck/src/reduce.c -o build/temp.linux-x86_64-3.9/bottleneck/src/reduce.o -O2 In file included from bottleneck/src/reduce.c:1: bottleneck/src/bottleneck.h:4:10: fatal error: Python.h: No such file or directory 4 | #include <Python.h> | ^~~~~~~~~~ compilation terminated. error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /home/me/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u7f_8_0k/bottleneck_1375337c49c246109b2e650965628211/setup.py'"'"'; file='"'"'/tmp/pip-install-u7f_8_0k/bottleneck_1375337c49c246109b2e650965628211/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-pgrmqqqd/install-record.txt --single-version-externally-managed --compile --install-headers /home/me/venv/include/site/python3.9/Bottleneck Check the logs for full command output.

我在 Ubuntu 20.04,我的 python 版本是-

Python 3.9.0+

我试过单独安装 Bottleneck,

pip install Bottleneck --no-cache-dir

但这也给出了同样的错误。已查看相关主题的解决方案,

fatal error: Python.h: No such file or directory

setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Failed building wheel for bottleneck error

但运气不好。任何帮助将不胜感激。

所以..最后这就是让它工作的原因...必须安装 python3.9-dev.