Anaconda2 and 3 virtual environments have already been installed in pyenv.
--tensorflow installation Use Anaconda install (https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#pip-installation)
$ conda create -n tf-cpu python=3.5
$ conda install -c conda-forge tensorflow
--Checking the anaconda virtual environment
$ conda env list
tf-cpu * ~/pyenv/versions/anaconda3-4.1.0/envs/tf-cpu
root ~/.pyenv/versions/anaconda3-4.1.0
$ conda create -n tf-cpu python=3.5
$ conda install -c conda-forge tensorflow
Verification I was able to import it with the python shell, but I can't read it with ipython. It seems that it refers to the directory of the virtual environment on pyenv instead of the virtual environment of conda. If you think about it carefully, you can see it when ipython is running even though ipython is not installed on conda in the first place ...
$ ipython
In [1]: import numpy
In [2]: import tensorflow
error
--Adding environment variables
If you write appropriate code in .ipython/profile_default/startup/
, it seems to be executed automatically at startup. Added the following to hoge.py
> import sys
> sys.path.append('~.pyenv/versions/anaconda3-4.1.0/envs/tf-cpu/lib/python3.5/site-packages/')
--Introduction of keras Only one line. Super easy (https://keras.io/ja/#_2)
> pip install keras
--Usually, you can switch the environment with source activate tf-cpu
, but it seems that you have to specify it with an absolute path on pyenv, so it is troublesome, so make it alias. I haven't changed the backend yet, and some people have written it, so I'll omit it.
$ tf-cpu
$ ipython
In [1]: import tensorflow
In [2]: import keras
Using TensorFlow backend.
In [3]:
Ok.
(http://dackdive.hateblo.jp/entry/2015/12/12/163400) Since it was described in detail in, a memo pyenv: Version control of python, only one virtual environment for each version vurtialenv: You can create a virtual environment with the same version pyenv-virtualenv: It seems that pyenv can be given any name. conda: I forgot, but I think conda is upward compatible with pyenv somewhere, so I plan to use this for the time being.
Recommended Posts