Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use tensorflow on spyder?

I am a new users for Python and want to use tensorflow. I think I successfully installed tensorflow on my mac OSX via Anaconda. But I still can't figure out how to use tensorflow on Spyder. Could someone help me? Many thanks!

like image 536
Oscar Avatar asked May 05 '16 02:05

Oscar


2 Answers

After installing Tensorflow using Anaconda based on Installing TensorFlow on Windows you must change your Environment for Spyder.

1) Open Anaconda Navigator

2) In top left corner you see Selector: "Applications on: base(root)"

3) Change: "base root" for "Tensorflow" it assumes that it was already installed based on link above

4) Install Spyder

5) Open Spyder and make your first test file:

 010 import tensorflow as tf

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

 030 sess = tf.Session()

 040 print(sess.run(hello))

6) Run it in Spyder and it will work

like image 128
Ivo Rousar Avatar answered Jan 11 '23 16:01

Ivo Rousar


System default python maybe used on command line, first verify that you are using the python from anaconda distro. Set up the environment variables first.

If you are not building tensorflow with GPU support. you can install tensorflow through conda in one command.

$ conda install -c https://conda.anaconda.org/jjhelmus tensorflow

in Spyder: import tensorflow as tf. and you're good to go.

like image 34
iratzhash Avatar answered Jan 11 '23 14:01

iratzhash