If you are a beginner and don’t know how to install TensorFlow, I have explained the step-by-step procedure to install TensorFlow for three different platforms: Windows, Linux, and MacOS.
How to Install TensorFlow
To install Tensorflow on your computer or systems. First, ensure you have installed Python version 3.9 to 3.11, pip version 19.0 or higher for Windows and Linux, and 20.3 or higher for macOS.
If you haven’t installed Python, visit this Python download and installation tutorial.
I will show you how to install Tensorflow on Windows, Linux, and MacOS platforms. Let’s start installing Tensorflow.
There are two versions of TensorFlow that you can install on your system: Tensorflow-CPU and Tensorflow-GPU.
Tensorflow-CPU only uses the CPU resources for computation, whereas Tensorflow-GPU uses the GPU resources. Here, I will cover only the Tensorflow-CPU; to know how to install Tensorflow-GPU, follow this link.

Install Tensorflow on Windows
To install tensorflow on Windows, open the command prompt and create a virtual environment using the command below.
python -m venv tensorflow_envAfter creating the environment ‘tensorflow_env’, activate this environment using the command below.
tensorflow_env\Scripts\activateAfter activating the environment, install the latest version of tensorflow using the command below.
pip install tensorflow
If you see something like this in the above image, tensorflow is downloaded and installed on your system without any error.
To verify the installation of Tensorflow from your Windows, first open the Python shell using the command below.
pythonThen, import the TensorFlow library by giving the alias name tf using the command below.
import tensorflow as tfAfter that, to check the installed Tensorflow, run the command tf.__version__ as shown in the command below.
print(tf.__version__)
When you run the command, print(tf.__version__), the version number of TensorFlow is returned. As you can see in the above output, the version is 2.15.0. If you see that version of Tensorflow like that, you have successfully installed Tensorflow on Windows.
Moving on to the next step, let’s see how to install it on Linux.
Install Tensorflow on Linux
To install on Linux, first, ensure you have installed Python; if not, install it. also, some of the Linux distributions have Python pre-installed. So here, I will use the Ubuntu operation and show you how to install TensorFlow.
Ensure you have installed the latest version of Ubuntu (64-bit) or version 16.04 or higher; these steps can also be used in other distributions of Linux, but Tensorflow officially supports Ubuntu.
Next, before installing, check the version of Python in your terminal using the command below.
python3.11 --versionAfter that, create a new environment. You need to install the ‘venv’ package, and then you can create an environment; use the command below to install that package.
sudo apt install python3.11-venv
Then, close and open the terminal again. Create a virtual environment ‘tensorflow_env’ using the command below.
python3.11 -m venv tensorflow_envNow, activate the environment you created using the command below.
source tensorflow_env/bin/activateAfter activating environment ‘tensorflow_env’, install the latest version of Tensorflow using the command below.
pip install tensorflow
To verify the installation of Tensorflow on Linux (Ubuntu), activate the Python shell by typing Python3.11 in your terminal and hitting enter from your keyboard.
python3.11After entering into the Python shell, import the Tensorflow library using the command below.
import tensorflow as tfThen check the version of TensorFlow you installed just now; use the command tf.__version__ as shown below.
print(tf__version__)
As you can see, the latest version of the TensorFlow is 2.15.0. Also it indicates that you have successfully installed Tensorflow on the Linux system (Ubuntu).
Remember you can follow all the above steps for other Linux distros to install Tensorflow. Again, I want to say that before installing TensorFlow, check whether you have installed Python or not, and also check the package that allows you to create an environment for your project, such as Venv.
If you don’t want to install TensorFlow in a specific virtual environment such as tensorflow_env that you have created, then simply after checking the version of Python, run the command pip install tensorflow, and this will install TensorFlow in your current directory.
Finally, let’s look at how to install TensorFlow on MacOS.
Install Tensorflow on MacOS
Again, before installing TensorFlow, ensure you have installed the Python and the virtual environment package to create an environment.
To check the python on the MacOS, run the command below.
python3.11 --versionTo install the virtual environment package ‘virtualenv’, use the below command.
brew install virtualenvNow, create a new environment, ‘tensorflow_env, ‘ using the command below in your terminal.
virtualenv tensorflow_envActivate the created environment using the command below.
source tensorflow_env/bin/activateAfter activating the environment, install the TensorFlow using the command below.
pip install tensorflowTo verify the installation of Python, open the terminal or command prompt, then type the command below to open the Python shell.
python3.11Then, import the tensorflow library using the command below.
import tensorflow as tfAfter checking the version of installed TensorFlow using the function tf.__version__ as shown below.
print(tf.__version__)If you see the version, it’s something like 2.15.0; you have installed TensorFlow successfully on your macOS system.
Conclusion
In this tutorial, I have covered how to install TensorFlow on different platforms using the command pip install TensorFlow, especially since you have installed the CPU version of TensorFlow.
Additionally, you learned how to install TensorFlow on a specific platform like MacOS, Windows and Linux (Ubuntu). you also learned how to check the tensorflow version using the tf.__version__ function.
You may like to read:
- Tensorflow iterate over tensor
- Convert list to tensor TensorFlow
- Import error no module named TensorFlow

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.