1

Using a :

  • macOS High Sierra version 10.13.5
  • python version is 2.7.10

I am trying to install tensorflow on my macOS through native pip but i encountered an issue when trying to validate my installation. I am following the installation instructions from this website :

[1] https://www.tensorflow.org/install/install_mac#top_of_page

The issue occurs when I run the following short tensorflow program after I invoke python from it's shell

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

but I get in return :

... import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ImportError: No module named tensorflow
>>> hello = tf.constant('Hello, TensorFlow!')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'tf' is not defined
>>> sess = tf.Session()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'tf' is not defined
>>> print(sess.run(hello))

I used the following links to see if i can find the answer

ImportError: No module named tensorflow

https://github.com/tensorflow/tensorflow/issues/5478

ImportError: No module named tensorflow - Can't install Tensorflow

Also during the installation of native pip I did sudo install tornado & nose. The versions are Tornado 5.1 & nose 1.3.7

Tim
  • 10,459
  • 4
  • 36
  • 47
Alfred L.
  • 53
  • 5
  • What version of python do you have? I imagine 2.7 on your Mac? I’d suggest using the virtual environment installation with easy_install, have you tried that way? – lopezdp Jul 21 '18 at 03:39
  • 1
    I resolved the issue by uninstalling python 3.7 and installing 3.6.6. Doing so resolved my issue and I was able validate my installation. Thank you – Alfred L. Jul 31 '18 at 13:45

0 Answers0