Posted at

Ubuntu 15.10 で pyenv install 3.5.0 したら pip がインストールできなくて落ちる

More than 3 years have passed since last update.


症状

$ pyenv install 3.5.0

Downloading Python-3.5.0.tgz...
-> https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
Installing Python-3.5.0...
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/yyuu/pyenv/wiki/Common-build-problems

BUILD FAILED (Ubuntu 15.10 using python-build 20151222-7-g4c06f23)

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

Last 10 log lines:
(cd /home/utgw/.pyenv/versions/3.5.0/share/man/man1; ln -s python3.5.1 python3.1)
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Ignoring ensurepip failure: pip 7.1.2 requires SSL/TLS


原因

OpenSSL のライブラリが入ってない。


解決策

$ sudo apt-get install libssl-dev


蛇足

当方の環境だと、 libssl-dev を入れてからインストールしても、

WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?

WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?

って言われて不安な感じだったので、次のコマンドを実行してそれっぽいものをインストールしたら、警告表示されなくなった。

$ sudo apt-get install libbz2-dev libreadline-dev libsqlite3-dev


参考