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.
- 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/
- Set PYTHON_HOME variable as your Python installation directory.
- Add %PYTHON_HOME% and %PYTHON_HOME%/scripts to your SYSTEM PATH variable.
- Install Tensorflow for Windows with pip3 install –upgrade tensorflow
- Upgrade your Microsft Visual C++ Redistributable with the x64 version
You should now be good to go!
Test your Tensorflow installation.
- Create a file called test_tensorflow.py with your favourite text editor.
Write this code in that file. import tensorflow as tf hello = tf.constant('I have installed Tensorflow.') sess = tf.Session() print(sess.run(hello))
- Go to your cmd on the same directory and run python test_tensorflow.py
- 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.