当前位置:首页 > 操作系统 > MacOs

mac+anaconda+python3.7+tensorflow+jupyter

1、安装Anaconda环境,现在的anaconda安装很多时候没有网上的教程那么复杂。直接官网下载对应版本就可以了。

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片
选择 图形界面 安装  然后一路继续,选择路径后即可完成安装。(这里有个坑,18mbp下载清华镜像4.2版本存在闪退问题,按照网上教程难以解决,不建议安装,直接官网也挺快的。对了这个应该是集成了python3.7版本的,无需按其他教程里面那些做法下python)

2、根据上图的命令行语句,在mac终端上粘贴输入命令行搭建TensorFlow环境。打开terminal,用conda命令创建TensorFlow环境并激活。

<code>conda create -n tensorflow python=3.7

source activate tensorflow</code>

3、创建了tensorflow 环境后可以看到在这个目录下多了一个环境

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

 

打开anaconda后,寻找到对应的环境,在uninstall中找到需要的库——tensorflow 下载即可,自动把用到的库打包下载

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

4、安装jupyter

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

在home里面可以找到,install即可下载,也可以一键卸载。

5、在terminal中激活并启动环境

激活 tensorflow 环境:

<code>source activate tensorflow</code>

启动 jupyter:

<code>python -m IPython notebook</code>

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

即可进入一个web页面

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

右侧新建python,检验是否能使用tensorflow

mac+anaconda+python3.7+tensorflow+jupyter - 文章图片

<code>import tensorflow as tf
hello = tf.constant('we got it')
sess = tf.Session()
print (sess.run(hello))</code>

终于可以快乐使用tensorflow了 网上好多教程太老了 这个是个人经验 应该管用 2019.7.1 


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐