159
71

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyenvで3.7系のインストールに失敗したときのメモ

Last updated at Posted at 2018-07-08

エラー内容

3.6系までは普通にインストールできていたのに、3.7をインストールしようとしたら次のようなエラーでインストールに失敗。
ちなみにOSはUbuntu 18.04です。

$ pyenv install 3.7.0
Installing Python-3.7.0...

BUILD FAILED (Ubuntu 18.04 using python-build 1.2.3-79-gc057a80c)

Inspect or clean up the working tree at /tmp/python-build.20180708190520.14846
Results logged to /tmp/python-build.20180708190520.14846.log

Last 10 log lines:
  File "/tmp/tmppm_d6i5e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 42, in <module>
  File "/tmp/tmppm_d6i5e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in <module>
  File "/tmp/tmppm_d6i5e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in <module>
  File "/tmp/tmppm_d6i5e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 39, in <module>
  File "/tmp/tmppm_d6i5e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in <module>
  File "/tmp/python-build.20180708190520.14846/Python-3.7.0/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Makefile:1122: recipe for target 'install' failed
make: *** [install] Error 1

解決方法

libffi-devを入れることで解決

$ sudo apt install libffi-dev

CentOS系では以下aptの代わりにyumを実行します。

sudo yum install libffi-devel

Macでつまった時の話

Macでは「opensslがない」みたいなエラーが出ました。このブログが参考になりました。
どうやら、もとから入っているpythonはopensslなしでコンパイルされたものらしいです。

159
71
6

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
159
71

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?