使用 Python 工具通过 Visual Studios 运行 TensorFlow 时没有输出 [英] No output when running TensorFlow through Visual Studios with Python Tools

查看:33
本文介绍了使用 Python 工具通过 Visual Studios 运行 TensorFlow 时没有输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Visual Studio 设置已安装了 Python 工具和 CPython.

I have my Visual Studio's setup with Python Tools and CPython installed.

运行示例Hello World!"程序显示 Python 已在 Visual Studios 中正确设置并打印出消息.

Running a sample "Hello World!" program shows that Python is setup correctly in Visual Studios and the messages prints out.

但是,我希望将 Visual Studio 用作使用 TensorFlow 的首选 IDE.我已经导入了所有必要的包.然而,当运行如下所示的示例 TensorFlow 程序时,运行窗口只是显示一个黑屏.

However, I am looking to use Visual Studio as my IDE of choice for working with TensorFlow. I have imported all necessary packages. yet when running a sample TensorFlow program as shown below, the running window simply displays a black screen.

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')

sess = tf.Session()

print(sess.run(hello))
print("hey")

没有显示错误,没有消息,因此我不确定到底缺少什么或没有正确设置.

There are no errors shown, no messages hence I am unsure what exactly is missing or not setup correctly.

推荐答案

我遇到了同样的问题,结果证明这不是真正的问题!它确实有效,但需要很长时间才能向您展示某些东西,因此您可能认为它不起作用!只需几分钟,您就会看到输出.我仍然有处理时间很慢的问题,我不知道如何处理.可能是 VS 问题.

I had the same problem and turns out it was not really a problem! It actually works but it takes a noticeably long time to show you something so you might think its not working! Just give it a few minutes and you will see the output. Still I have the problem of very slow processing time which I don't know how to approach. Could be a VS problem.

这篇关于使用 Python 工具通过 Visual Studios 运行 TensorFlow 时没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆