経緯
Djangoを触りたくてチュートリアルを勉強中のDockerで実行しようとしたら
いろいろと下準備が必要だった話
前提
- dockerを使う。コンテナのイメージはcentos7:latest
- インストールするpythonは3.5.2でpyenvを使う
概要
Djangoのチュートリアルをするために、dockerのコンテナでpyenvを用いて、
pythonをインストール使用としたらエラーがでたのでちょっとづつ解決した。
解決の仕方
そんなんどーでもいいから、解決したい人は以下のスクリプトをコンテナ上で実行するとよいよい。
https://github.com/tomokitamaki/BuildForDockercontPython/tree/master
筆者の都合でDjangoのインストールまで行われます。
出てきたエラーと工程
pyenv 入れようとしたらgit なかった
- 以下で解決
[root@c72864a7fe2c ~]# yum install -y git
python インストールしようとしたらCコンパイラがなかった
- エラーメッセージ
[root@c72864a7fe2c ~]# pyenv install 3.5.2
sha256sum: the --quiet option is meaningful only when verifying checksums
Try 'sha256sum --help' for more information.
Downloading Python-3.5.2.tar.xz...
-> https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
Installing Python-3.5.2...
BUILD FAILED (CentOS Linux 7 using python-build 1.0.0-47-g5be82cb)
Inspect or clean up the working tree at /tmp/python-build.20160918121231.1047
Results logged to /tmp/python-build.20160918121231.1047.log
Last 10 log lines:
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/python-build.20160918121231.1047/Python-3.5.2':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[root@c72864a7fe2c ~]# cat /tmp/python-build.20160918121231.1047.log
- 以下で解決
[root@c72864a7fe2c ~]# yum install -y gcc
makeがない
- 以下で解決
[root@c72864a7fe2c ~]# yum install -y make
bzip2がない
- エラーメッセージ
# WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
- 以下で解決
[root@c72864a7fe2c ~]# yum install -y bzip2-libs.x86_64 bzip2 bzip2-devel.x86_64
GUN readlineがない?
- エラーメッセージ
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
- 以下で解決
[root@c72864a7fe2c ~]# yum install -y readline readline-devel.x86_64
opensslのライブラリがない
エラーメッセージ
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
以下で解決
[root@c72864a7fe2c ~]# yum install openssl openssl-devel.x86_64
sqliteがない
- エラーメッセージ
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
- 以下で解決
[root@c72864a7fe2c ~]# yum install sqlite-devel.x86_64