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

Python3.7.0のインストールに失敗

More than 1 year has passed since last update.

はじめに

GCPでpythonの環境構築をしていて詰まって解決したところまで書きます。

試み

こちらの記事を参考に環境を構築しようと試みました。

詰まったところ

記事を参考にpyenv install --listをみて3.7.0を入れようとしたところ、

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

と出ちゃいました。
ちなみに3.6.7だと通りました。

解決

同じ事例を発見しました。
こちらだとlibffi-devをインストールしたら解決したようです。
yumで入れます。

$ sudu yum install libffi-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.fileplanet.com
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirror.fileplanet.com
 * updates: mirrors.usc.edu
No package libffi-dev available.
Error: Nothing to do

そんな物は無い的なことをいわれたので、探します。

$ sudo yum search libffi-dev
ghc-libffi-devel.x86_64 : Haskell libffi library development files
libffi-devel.i686 : Development files for libffi
libffi-devel.x86_64 : Development files for libffi

ありました。libffi-develでいいのかな?

$ yum install libffi-devel
  :
  :
Installed:
  libffi-devel.x86_64 0:3.0.13-18.el7                                                               

Complete!

今度は行けたようです。
このあと$ pyenv install 3.7.0でインストール出来ました。

Why do not you register as a user and use Qiita more conveniently?
  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
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