質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

8743閲覧

pyenvでpythonがインストールできない

noz_awsinf_sp

総合スコア62

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2019/11/04 11:35

amazonlinux2にてpyenvをインストールしてpythonをインストールしようとするとgcc周りでエラーが
発生してインストールが完了しません。
どのように修正したらよいでしょうか。

$ pyenv --version
pyenv 1.2.14-11-gb5f69fe5

uname -a
Linux ip-10-0-0-125.ap-northeast-1.compute.internal 4.14.138-114.102.amzn2.x86_64 #1 SMP Thu Aug 15 15:29:58 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ gcc --version
gcc (Homebrew gcc 5.5.0_4) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

================

[ec2-user@ip-10-0-0-125 ~]$ pyenv install 3.6.5
Downloading Python-3.6.5.tar.xz...
-> https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
Installing Python-3.6.5...
python-build: use readline from homebrew

BUILD FAILED (Amazon Linux 2 using python-build 1.2.14-11-gb5f69fe5)

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

Last 10 log lines:
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /tmp/python-build.20191104102007.28294/Python-3.6.5': configure: error: C compiler cannot create executables See config.log' for more details

●config.log

===============
[ec2-user@ip-10-0-0-125 ~]$ cat /tmp/python-build.20191104101045.19707/Python-3.6.5/config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by python configure 3.6, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure --prefix=/home/ec2-user/.pyenv/versions/3.6.5 --libdir=/home/ec2-user/.pyenv/versions/3.6.5/lib

---------

Platform.

---------

hostname = ip-10-0-0-125.ap-northeast-1.compute.internal
uname -m = x86_64
uname -r = 4.14.138-114.102.amzn2.x86_64
uname -s = Linux
uname -v = #1 SMP Thu Aug 15 15:29:58 UTC 2019

/usr/bin/uname -p = x86_64
/bin/uname -X = unknown

/bin/arch = x86_64
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: /home/ec2-user/.pyenv/libexec
PATH: /home/ec2-user/.pyenv/plugins/python-build/bin
PATH: /home/ec2-user/.pyenv/shims
PATH: /home/ec2-user/.pyenv/bin
PATH: /home/linuxbrew/.linuxbrew/bin
PATH: /home/linuxbrew/.linuxbrew/sbin
PATH: /home/linuxbrew/.linuxbrew/bin
PATH: /home/linuxbrew/.linuxbrew/sbin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /home/ec2-user/.local/bin
PATH: /home/ec2-user/bin
PATH: /home/ec2-user/.local/bin
PATH: /home/ec2-user/bin

-----------

Core tests.

-----------

configure:2795: checking build system type
configure:2809: result: x86_64-pc-linux-gnu
configure:2829: checking host system type
configure:2842: result: x86_64-pc-linux-gnu
configure:2872: checking for python3.6
configure:2902: result: no
configure:2872: checking for python3
configure:2888: found /home/linuxbrew/.linuxbrew/bin/python3
configure:2899: result: python3
configure:2999: checking for --enable-universalsdk
configure:3046: result: no
configure:3069: checking for --with-universal-archs
configure:3084: result: no
configure:3234: checking MACHDEP
configure:3443: result: linux
configure:3464: checking for --without-gcc
configure:3487: result: no
configure:3490: checking for --with-icc
configure:3510: result: no
configure:3634: checking for gcc
configure:3650: found /home/linuxbrew/.linuxbrew/bin/gcc
configure:3661: result: gcc
configure:3890: checking for C compiler version
configure:3899: gcc --version >&5
gcc (Homebrew gcc 5.5.0_4) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3910: $? = 0
configure:3899: gcc -v >&5
Reading specs from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_4/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_4/libexec/gcc/x86_64-unknown-linux-gnu/5.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-isl=/home/linuxbrew/.linuxbrew/opt/isl@0.18 --with-bugurl=https://github.com/Linuxbrew/homebrew-core/issues --prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_4 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion='Homebrew gcc 5.5.0_4' --with-boot-ldflags='-static-libstdc++ -static-libgcc ' --disable-nls --disable-multilib
Thread model: posix
gcc version 5.5.0 (Homebrew gcc 5.5.0_4)
configure:3910: $? = 0
configure:3899: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3910: $? = 1
configure:3899: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3910: $? = 1
configure:3930: checking whether the C compiler works
configure:3952: gcc -I/home/linuxbrew/.linuxbrew/opt/readline/include -I/home/ec2-user/.pyenv/versions/3.6.5/include -L/home/linuxbrew/.linuxbrew/opt/readline/lib -L/home/ec2-user/.pyenv/versions/3.6.5/lib conftest.c >&5
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3956: $? = 1
configure:3994: result: no
configure: failed program was:
| /* confdefs.h /
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _BSD_TYPES 1
| #define _DARWIN_C_SOURCE 1
| #define _XOPEN_SOURCE 700
| #define _XOPEN_SOURCE_EXTENDED 1
| #define _POSIX_C_SOURCE 200809L
| /
end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3999: error: in `/tmp/python-build.20191104101045.19707/Python-3.6.5':
configu

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

コンパイルに必要な開発用のパッケージが不足していると思われます。

Home · pyenv/pyenv Wiki

上記を参考に、パッケージを追加してください。

Amazon Linux 2はRHEL 7/CentOS 7を基にしているそうですので、CentOS/Fedora 21 and belowの部分を参考に、パッケージを追加してください。ただし、完全にCentOSと同じでは無いため、問題が起きた場合はその旨を質問に追記してください。(私はAWSを使っていないので、答えられませんが、他の誰かが答えてくれるかも知れません)

投稿2019/11/04 12:13

raccy

総合スコア21735

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問