How to install Tensorflow in Windows

install tensorflow on windows

Installing Tensorflow like a boss on a Windows machine has never been easier

Tensorflow is an amazing library that lets you do a lot of Machine Learning and Deep Learning tasks.

But it takes an unnecessary longer time to install in a Windows environment. Here’s a quick guide that will speed up your process. Make sure you are on a 64 bit system.

  1. Install Python 3.5.2
    The version 3.5.2 is very important. Tensorflow runs only ont his version as far as I know. https://www.python.org/downloads/release/python-352/
  2. Set PYTHON_HOME variable as your Python installation directory.
  3. Add %PYTHON_HOME% and %PYTHON_HOME%/scripts to your SYSTEM PATH variable.
  4. Install Tensorflow for Windows with pip3 install –upgrade tensorflow 
  5. Upgrade your Microsft Visual C++ Redistributable with the x64 version 

You should now be good to go!

Test your Tensorflow installation.

  1. Create a file called test_tensorflow.py with your favourite text editor.
  2. Write this code in that file.
    
    import tensorflow as tf 
    hello = tf.constant('I have installed Tensorflow.') 
    sess = tf.Session() 
    print(sess.run(hello))
  3. Go to your cmd on the same directory and run python test_tensorflow.py
  4. It should print “I have installed Tensorflow”.

 

It’s really that simple. But tiny things like version and Visual C++ update cause issues as they are not directly reported in the errors. You have to read documentation and Stack Overflow threads to find them out. This guide worked well on my machine.

Check out the official guide here.

 


 

Join the mailing list!

I've tried to keep the posts as brief as possible, respectful of your time. If you want to be notified of new posts, just enter your email!

Follow me on Twitter

Comments