How to Install TensorFlow 2 Using Conda
TensorFlow is a library for building and deploying machine learning and deep learning models. TensorFlow 2 is an updated version of TensorFlow.
Conda is the package manager, which helps in getting and updating new packages. To use conda, you must install the Anaconda and assign its path in the environment variable to use in the Windows command prompt.
If you want to install any library, you can use either the conda
or pip
package manager.
This article will use conda
to install TensorFlow 2.
Install TensorFlow 2 Using Conda
You can use the following syntax to install TensorFlow:
conda install tensorflow
You can use this code in the Windows or Anaconda terminal. It will install the TensorFlow library like this:
It will automatically install the updated version of TensorFlow. It will ask to install some of the packages or libraries related to TensorFlow, and then it is completely installed.
You can check the installed version of TensorFlow by using the following command.
conda list tensorflow
Output:
Install TensorFlow 2 by Making an Environment Variable
In this section, we will look into installing TensorFlow by making a variable of the environment.
First, let’s create an environment using the following command:
conda create -n env_name
Here you can name your environment in place of env_name
.
Output:
Here, we have created an environment named upwork
.
Let’s activate this environment. To start, you can use the following command:
conda activate env_name
Here my environment env_name
is upwork
.
Output:
Now, let’s install TensorFlow in this environment:
conda install tensorflow
Output:
To confirm whether TensorFlow is installed or not, we can check it using the following command:
conda list tensorflow
Output:
Shiv is a self-driven and passionate Machine learning Learner who is innovative in application design, development, testing, and deployment and provides program requirements into sustainable advanced technical solutions through JavaScript, Python, and other programs for continuous improvement of AI technologies.
LinkedIn