pyenv の install
brew で install
$ brew install pyenv
.zsrc に追記
.zshrc
eval "$(pyenv init -)"
export PATH="$HOME/.pyenv/bin:$PATH"
anaconda3 の install
anaconda3 の version を確認
$ pyenv install --list | grep anaconda3
...
anaconda3-5.0.1
最新を install
$ pyenv install anaconda3-5.0.1
anaconda3-5.0.1 を使用
$ pyenv global anaconda3-5.0.1
$ python -V
Python 3.6.3 :: Anaconda, Inc.
Anaconda で Python 3.6 用の環境構築
py3.6 という名前で 3.6 用の環境を構築
$ conda create -n py3.6 pip python=3.6
作成した環境を active に
$ source activate py3.6
Usage: pyenv which <command>
うまくいかない。
どうも anaconda3 の path で上書かないと source コマンドが使えないよう
.zshrc
# pyenv
eval "$(pyenv init -)"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# anaconda
export PATH="$PYENV_ROOT/versions/anaconda3-5.0.1/bin/:$PATH"
$ source activate py3.6
ok
TensorFlow の install
TensorFlow の package URL を .zshrc に追記(しなくてもいい)
.zshrc
export TF_PYTHON_URL="https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0-py3-none-any.whl"
TensorFlow の install
$ pip install --ignore-installed --upgrade $TF_PYTHON_URL
TensorFlow の install page にある sample を実行
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
python sample.py
2018-02-11 19:32:04.474567: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
b'Hello, TensorFlow!'
warning が出てるけど、動いている
Keras の install
$ pip install keras
完了