To install TensorFlow on a Linux system, you can follow these steps:
- Verify your system requirements:
Make sure your system has a compatible CUDA GPU if you plan on using GPU acceleration.
Ensure that you have Python 3.6-3.8 installed on your system.
- Create a virtual environment (optional but recommended):
Setting up a virtual environment helps in managing project dependencies without affecting the system's Python installation. You can use the virtualenv command for this purpose.
- Install TensorFlow using pip:
Open a terminal and activate your virtual environment (if applicable).
Use the following command to install TensorFlow:
pip install tensorflow
- Verify the installation:
Open a Python interpreter or start a Python script.
Import TensorFlow to verify installation success:
import tensorflow as tf
If the TensorFlow version is displayed without any errors, then it is installed correctly.
Note: For GPU acceleration, additional CUDA and cuDNN libraries need to be installed. The process varies based on your GPU and Linux distribution. It is recommended to follow the official TensorFlow GPU installation guide for detailed instructions specific to your setup.