Install TensorFlow with Python
Install TensorFlow with Python
TensorFlow is an open-source machine learning (ML) framework developed by Google. It is primarily used for building and deploying deep learning models, though it also supports traditional machine learning algorithms. TensorFlow offers a variety of tools and libraries to help with everything from data manipulation to model building and deployment, making it highly popular for AI development. To install TensorFlow with Python, follow these steps:
Set up Python Environment
Check Python Version. TensorFlow requires Python 3.7 or later.
Check your Python version
python –version
or
python3 –version
Create a Virtual Environment
Its recommended to create a Python virtual environment.
python -m venv tensorflow_env
Activate the environment
On Windows:
tensorflow_env\Scripts\activate
On Linux:
source tensorflow_env/bin/activate
Install TensorFlow
Update pip to the latest version:
pip install –upgrade pip
Install TensorFlow
Run the following command to install TensorFlow:
pip install tensorflow
For GPU support (if you have a compatible GPU):
pip install tensorflow-gpu
Verify Installation
To verify the installation, open Python IDE and run the following code. Import TensorFlow and check its version:
import tensorflow as tf
print(tf.__version__)