zl程序教程

您现在的位置是:首页 >  其他

当前栏目

ubuntu20.04在VS code下完美创建jupyter文件的tensorflow环境

文件vscode 环境 创建 完美 Tensorflow Jupyter
2023-09-14 09:15:33 时间

本文的操作是在你已经安装和配置好tensorflow(简称tf)的情况下,详细的操作步骤如下:

第一步:首先准备好带测试的代码

import tensorflow as tf

if __name__=='__main__': 
    g = tf.Graph()   
    # add ops to the user created graph
    with g.as_default(): 
        hello = tf.constant('Hello Tensorflow') 
        sess = tf.compat.v1.Session(graph=g)
        print(sess.run(hello))

第二步:在VS code下载插件jupyter

在这里插入图片描述

第三步:设置编译环境为tensorflow

在这里插入图片描述

最后一步:执行待测试的源码

在这里插入图片描述

测试成功。