how to install tensorflow
- User
how to install tensorflow
- Assistant
To install TensorFlow, follow these steps:
-
Choose the appropriate installation method for your system:
- For CPU-only installation, use the command:
pip install tensorflow - For installation with GPU support (requires CUDA-enabled GPU), use the command:
pip install tensorflow-gpu
- For CPU-only installation, use the command:
-
Optionally, create a virtual environment to isolate TensorFlow from your system's Python installation. This is recommended to avoid conflicts with other packages. You can create a virtual environment using tools like
virtualenvorconda. -
Activate the virtual environment, if applicable.
-
Open a terminal or command prompt and run the installation command mentioned above.
Note: TensorFlow requires Python 3.5-3.9, so make sure you have an appropriate Python version installed.
Once the installation is complete, you can verify it by opening a Python interpreter and importing TensorFlow:
import tensorflow as tf print(tf.__version__)If a version number is displayed without any errors, then TensorFlow is successfully installed on your system.
-