LoginSignup
3
3

More than 3 years have passed since last update.

Python3.8でuWSGIをインストールする時の「Python.h: No such file or directory」に対処した

Last updated at Posted at 2020-07-01

Ubuntu上で、Poetryを使って仮想環境上にuWSGIをインストールしようとすると、次のようなエラーが出ました。

poetry install

エラーメッセージの中で原因となっている箇所はこちらです。

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

Python3かつvenv使用時にuWSGIをインストールする時の注意点」という記事もあり、こちらでは sudo apt-get install python3-dev で解決すると書いていたのですが、実は python3-dev は既にインストールしていたにも関わらずこのエラーが出てしまっていました。

更に調べると、「fatal error: Python.h: No such file or directory」に解決方法が載っていました。どうやら python3.x-dev をバージョン指定してインストールする必要があったようです。こちらのコマンドで解決しました。

sudo apt-get install python3.8-dev

最初はPoetry自体のエラーだと考えていて、少し原因の特定に時間がかかってしまいました。同様の問題にハマってしまった人のお役に立てると嬉しいです。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3