Help us understand the problem. What is going on with this article?

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

エラー内容

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なしでコンパイルされたものらしいです。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした