Tensorflow "Hello World" example does not work in PyCharm

1

I entered these code in PyCharm and included Tensorflow in interpreter:

import tensorflow
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

However the terminal didn't print anything and output was "Process finished with exit code -1073741819 (0xC0000005)"

enter image description here

enter image description here

python
tensorflow
asked on Stack Overflow Oct 13, 2018 by Wai Cheung Wong • edited Oct 13, 2018 by VinothRaja

2 Answers

1

Replace import tensorflow with import tensorflow as tf, also it is probably good to rename your script other than tf.py.

answered on Stack Overflow Oct 13, 2018 by unlut
1

You are refering to tf in your code, therefore you have to import tensorflow as tf.

In addition you should rename your filename. For example change tf.py to main.py.

answered on Stack Overflow Oct 13, 2018 by TimH

User contributions licensed under CC BY-SA 3.0