LoginSignup
47
25

More than 5 years have passed since last update.

High Sierra(macOS 10.13)でpyenvがエラーになった時に対処した方法

Last updated at Posted at 2017-10-01

発生したエラー

pyenv install 3.6.0
Downloading Python-3.6.0.tar.xz...
-> https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
Installing Python-3.6.0...
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 (OS X 10.13 using python-build 20160602)

対処方法

初めに

以下のコマンドを実行

brew install readline openssl xz

次に~/.env-exporterに以下の記述をする

# ~/.env-exporter
# about zlib
export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include"
# about readline
export CFLAGS="-I$(brew --prefix readline)/include $CFLAGS"
export LDFLAGS="-L$(brew --prefix readline)/lib $LDFLAGS"
# about openssl
export CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS"
export LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS"
# about SQLite (maybe not necessary)
export CFLAGS="-I$(brew --prefix sqlite)/include $CFLAGS"
export LDFLAGS="-L$(brew --prefix sqlite)/lib $LDFLAGS"

pyenv installを実行するする前

source ~/.env-exporter

いつもどおりインストール

pyenv install 3.6.0

以上で正常にインストールして出来る様になりました。

47
25
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
47
25