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

本文的操作是在你已经安装和配置好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

在这里插入图片描述

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

在这里插入图片描述

测试成功。

猜你喜欢

转载自blog.csdn.net/weixin_41194129/article/details/107443077
今日推荐