python2
沙盒环境下安装
利用Anacoda安装了一个沙盒环境,环境名字就叫tensorflow
conda create -n tensorflow python=2.7
激活环境,注意以后每次使用tensorflow时都需要激活
source activate tensorflow
在沙盒环境中,使用 conda 安装 TensorFlow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0rc0-py2-none-any.whl
结束tensorflow运行时需要关闭环境
source deactivate
可能出现的问题及解决方法
通过如下命令获得现有的notebook路径及名称
ipython kernelspec install-self --user #old_kernel_path_and_name
为新笔记本建立路径
mkdir -p ~/.ipython/kernels/
保存新笔记本的路径
mv old_kernel_path_and_name /.ipython/kernels/
更名新笔记本为tfkernel,将下面路径中的kernel.json文件中的python2换成tfkernel即可
cd ~/.ipython/kernels/tfkernel
最后在沙盒环境中执行 jupter notebook ,新建一个kernel时便可以看到tfkernel了
python3
重新安装了python3的沙盒环境
conda create --name python36 python=3.6
激活新建的python3环境
source activate python36
新建py3下的jupyter notebook
ipython kernel install --user --name=python3
查看现在jupyter kernel的版本,有python3的就好了
jupyter kernelspec list
激活tensorflow环境
source activate tensorflow