我试图在Anaconda环境(OSX)中安装Keras,因为我想与Spyder - IPython一起使用。为此,我只需使用命令
我认为这个问题可能与MacBook上的路径有关,因为
此外,在运行
我的 ~/.bash_profile 包含:
pip install keras
(我已经有了tensorflow)。安装后,当我从终端调用Python2.7时,Keras可以正常工作。但是,当我调用Python3.5或Spyder并尝试导入Keras时,我收到以下错误信息:'No module named 'keras''。我认为这个问题可能与MacBook上的路径有关,因为
which python
返回结果:/usr/local/bin/python2.7
当运行 which python3.5 (或 spyder)
命令时,会返回以下结果:
/Users/georgiospapadopoulos/anaconda/bin/python3.5
/Users/georgiospapadopoulos/anaconda/bin/spyder
此外,在运行
pip install keras
时,显示:Requirement already satisfied: keras in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
我的 ~/.bash_profile 包含:
# 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