Python 3.7のインストールに失敗するときに

Ubunut 18.04にpyenvで以下のような感じでPython 3.7のインストールに失敗するときには

$ pyenv install 3.7.3
 Downloading Python-3.7.3.tar.xz…
 -> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
 Installing Python-3.7.3…
 BUILD FAILED (Ubuntu 18.04 using python-build 1.2.11-11-g7dd50144)
 Inspect or clean up the working tree at /tmp/python-build.20190516184525.2792
 Results logged to /tmp/python-build.20190516184525.2792.log
 Last 10 log lines:
   File "/tmp/tmp97wtapkd/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/init.py", line 6, in 
   File "/tmp/tmp97wtapkd/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/completion.py", line 6, in 
   File "/tmp/tmp97wtapkd/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 20, in 
   File "/tmp/tmp97wtapkd/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 37, in 
   File "/tmp/tmp97wtapkd/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in 
   File "/tmp/python-build.20190516184525.2792/Python-3.7.3/Lib/ctypes/init.py", line 7, in 
     from _ctypes import Union, Structure, Array
 ModuleNotFoundError: No module named '_ctypes'
 Makefile:1130: recipe for target 'install' failed
 make: *** [install] Error 1

以下のような感じで、libffi-devを入れておく。

$ sudo apt install libffi-dev

コメントを残す

メールアドレスが公開されることはありません。