How to install Tensorflow in windows

How to install Tensorflow in windows

  • Main Steps followed:
  • Install Anaconda
  • Create a .yml file to install dependencies
  • Use pip to add TensorFlow
  • Launch Jupyter Notebook

First of all you have to Install Anaconda from below link

Download anaconda from here Install anaconda

Create .yml file to install Tensorflow and dependencies

  • It includes
  • Locate the path of Anaconda
  • Set the working directory to Anaconda
  • Create the yml file (For MacOS user, TensorFlow is installed here)
  • Edit the yml file
  • Compile the yml file
  • Activate Anaconda
  • Install TensorFlow (Windows user only)

Step 1) Locate Anaconda

Command: C:\>where anaconda

We have to create a new folder inside Anaconda folder that folder contains Ipython, Jupyter and TensorFlow. This is faster way to install libraries and softwares is to write a yml file.

Step 2) Set working directory

You have to set a working directory where yml file will be placed.

For Windows user (make sure of the folder before Anaconda3):

Command: cd C:\Users\Admin\Anaconda3

(Select your own admin name) or the path "where anaconda" command gives you

Step 3) Create the yml file

Now you have to create yml file copy and paste below code to your terminal

Command: echo.>hello-tf.yml

A new file will be create which named hello-tf.yml inside anaconda3 folder

Step 4: Edit yml file

You are ready now to edit your yml file by copy below code to your teminal

Command: vi hello-tf.yml

You can use Notepad to complete this step.

Copy and paste this command to your cmd

Command: notepad hello-tf.yml

Enter below code to your file

name: hello-tfdependencies:  

- python=3.6  

- jupyter  

- ipython  

- pandas

Step 5) Compile the yml file

To compile the .yml file use below code which will develop conda environment:

Command: conda env create -f hello-tf.yml

It takes times. It will take around 1.1gb of space in your hard disk.

Step 6) Activate conda environment

Command: conda env list

You need to switch to hello-tf to activate the environment

Command: activate hello-tf

Step 7) For Windows user only: Install TensorFlow

where python

where jupyter

where ipython

Install Tensorflow:

Command: pip install tensorflow

Last Process:

You will proceed as follow:

  • Activate hello-tf conda environment
  • Open Jupyter
  • Import tensorflow
  • Delete Notebook
  • Close Jupyter

Step 1) Activate conda

Command: conda activate hello-tf

Step 2) Open Jupyter

Command: jupyter notebook

Step 3) Import Tensorflow

To import tensorflow below step is followed

import tensorflow as tf

Let's write your first code with TensorFlow.

hello = tf.constant('Hello, gooposts!')


Congratulation. You successfully install TensorFlow with Jupyter on your Machine.

You have to open a new session with for each transection of jupyter and new opening

Command: source activate hello-tf


Enjoyed this article? Stay informed by joining our newsletter!


You must be logged in to post a comment.

Related Articles
Jan 7, 2021, 9:13 PM - aayan
About Author
Recent Articles
Jan 22, 2022, 1:28 PM Zakia
Jan 22, 2022, 1:25 PM Zakia
Jan 22, 2022, 1:24 PM Zakia
Jan 22, 2022, 1:24 PM Zakia
Jan 22, 2022, 1:22 PM Zakia