Install Keras on Anaconda OSX

I am trying to install keras in anaconda (OSX) environment because I want to use it with spyder - ipython. For this, I just used pip install keras(I already have a tensor). After installation, when I call python 2.7 from the terminal, keras works fine. But, when I call python 3.5 or spyder and try to import keras, I get: There is no module named "keras"

I assume that the problem may be related to PATHS on my MacBook because it which pythonreturns

/usr/local/bin/python2.7 

while which python3.5 (or spyder)returns

/Users/georgiospapadopoulos/anaconda/bin/python3.5
/Users/georgiospapadopoulos/anaconda/bin/spyder

In addition, while pip install kerasit is shown that

Requirement already satisfied: keras in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

My ~ / .bash_profile contains

# added by Anaconda3 2.4.0 installer
export PATH="/Users/georgiospapadopoulos/anaconda/bin:$PATH"

# added by Anaconda3 4.2.0 installer
export PATH="/Users/georgiospapadopoulos/anaconda/bin:$PATH"
export CUDA_HOME=/usr/local/cuda
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$CUDA_HOME/lib"
export PATH="$CUDA_HOME/bin:$PATH"

# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
PATH="/usr/local/bin/python:$PATH"
export PATH
+4
source share
2

, . - env Anaconda - , neural-net-venv, venv keras . Anaconda dash venv . Jupyter Spyder .

, Python - Py2 Py3 - , keras, theanos/tensorflow , .

MacOS .

+1

keras Anaconda - anaconda prompt, :

conda install keras

Keras tensorflow, theano. keras, python

>>>import keras

, - . anaconda

conda import tensorflow

theano . tensorflow .

+1

Source: https://habr.com/ru/post/1672518/


All Articles