💨
python.h No such file or directory に出会った
環境・状況
- win11, wsl2(ubuntu 22.04)
- python 3.10.6
- poetry
poetry環境でpycocotoolsをinstall
poetry add pycocotools
エラー内容
なんかいろいろlogが出た中に
...
pycocotools/_mask.c:6:10: fatal error: Python.h: No such file or directory
6 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
解決法
python3-devをインストールするだけでOKでした。 無事pycocotoolsがinstallできました。
sudo apt install python3-dev
参考
ここにpythonの開発用ツールを入れようとの記載がありました。
こういう小さいことでも軽率に書けるようにしたい。
Discussion