2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Tips】pyenvでPython3系の3.5.3未満をインストールしようとしたときに発生するエラーへの対処

Posted at

問題:Pythonインストールにおけるエラー

入力

pyenv install 3.4.8

出力

Downloading Python-3.4.8.tar.xz...
-> https://www.python.org/ftp/python/3.4.8/Python-3.4.8.tar.xz
Installing Python-3.4.8...
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/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (Ubuntu 18.04 using python-build 1.2.19-1-gece59ca8)

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

Last 10 log lines:
(cd /home/【ユーザ名】/.anyenv/envs/pyenv/versions/3.4.8/share/man/man1; ln -s python3.4.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 9.0.1 requires SSL/TLS

環境

  • Ubuntu 18.04 LTS (Windows 10 2004 WSL1上環境)
  • anyenv
    • pyenv 1.2.19-1-gece59ca8

原因:OpenSSLの対応バージョン

Python3系のの3.5.2まではOpenSSLの1.1に未対応。

解決方法:OpenSSLのダウングレード

sudo apt install libssl1.0-dev
pyenv install 3.4.8

補足

1. 事後処理

OpenSSL1.0をインストールすることでOpenSSLがダウングレードしてしまう。
Pythonのインストールが無事終了したら以下を実行。

sudo apt install libssl-dev

2. Rubyの場合

Rubyにおいても2.4未満で同様の原因によるエラーが発生する。
くわしくはこちらの記事を参照。

参考文献

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?