系统要求及前提条件
macOS 10.12.6 (Sierra) 或更高版本(64 位)(不支持 GPU) 需要 Python 3.4、3.5 或 3.6 虽然我们建议使用 TensorFlow
提供的 pip
软件包,但也可以使用由社区提供支持的 Anaconda
软件包。
安装
conda create -n tensorflow_p36 pip python=3.6 # 使用 `Anaconda ` 创建`tensorflow_p36`环境。制定python 为 3.6 版本。
从上面安装的软件包里我们看到也装了pip 激活环境: conda activate tensorflow_p36
使用pip
安装 tensorflow
:pip install tensorflow
如果下载速度很慢可以,指定镜像
添加Anaconda的TUNA镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# TUNA的help中镜像地址加有引号,需要去掉
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
参考链接 我这里网速还可以,所以我并没有使用镜像。 输入命令:jupyter notebook
打开jupyter notebook 但是发现新建环境里并没有我们刚刚安装的环境,怎么回事呢?因为我们并没有把这个环境添加到kenerl
里,这里我能推荐一个插件来解决这个问题nb_conda
(名字取的也是牛逼),安装命令
conda install nb_conda
The 'kernel_spec_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x109870490> instance must be a type, but u'nb_conda_kernels.CondaKernelSpecManager' could not be imported
pip install environment_kernels
结果如下
总结
Mac 安装的tensorflow
不支持 gup
用conda
安装便捷方便 nb_conda
插件将环境加入到kenerl
中