Anaconda makes it easy to install TensorFlow, enabling your data science, machine learning, and artificial intelligence workflows.
This page shows how to install TensorFlow with the conda package manager included in Anaconda and Miniconda.
TensorFlow with conda is supported on 64-bit Windows 7 or later, 64-bit Ubuntu Linux 14.04 or later, 64-bit CentOS Linux 6 or later, and macOS 10.10 or later.
The instructions are the same for all operating systems. No
apt install or
yum install commands are required.
On Windows open the Start menu and open an Anaconda Command Prompt. On macOS or Linux open a terminal window. Use the default bash shell on macOS or Linux.
Choose a name for your TensorFlow environment, such as “tf”.
To install the current release of CPU-only TensorFlow, recommended for beginners:
conda create -n tf tensorflow conda activate tf
Or, to install the current release of GPU TensorFlow on Linux or Windows:
conda create -n tf-gpu tensorflow-gpu conda activate tf-gpu
TensorFlow is now installed and ready to use.
GPU TensorFlow uses CUDA. On Windows and Linux only CUDA 10.0 is supported for the TensorFlow 2.0 release. Previous versions of TensorFlow support other version of CUDA.
To install GPU TensorFlow with a non-default CUDA version such as 9.0 run:
conda create -n tf-gpu-cuda8 tensorflow-gpu cudatoolkit=9.0 conda activate tf-gpu-cuda8
We recommend Python 3, but it is possible to use TensorFlow with Python 2 on Linux and macOS.
CPU-only TensorFlow on Python 2 on Linux or macOS:
conda create -n tf-2 tensorflow python=2 conda activate tf-2
GPU TensorFlow on Python 2 on Linux:
conda create -n tf-2-gpu tensorflow python=2 conda activate tf-2-gpu
Advanced users may wish to install the latest nightly build of TensorFlow. These nightly builds are unstable and are only available as pip packages on PyPI.
To install the nightly build of CPU-only TensorFlow:
conda create -n tf-n python conda activate tf-n pip install tf-nightly
Or, to install the nightly build of GPU TensorFlow on Linux or Windows:
conda create -n tf-n-gpu python conda activate tf-n-gpu pip install tf-nightly-gpu
Nightly build of CPU-only TensorFlow on Python 2 on Linux or macOS:
conda create -n tf-2-n python=2 conda activate tf-2-n pip install tf-nightly
Nightly build of GPU TensorFlow on Python 2 on Linux:
conda create -n tf-2-n-gpu python=2 conda activate tf-2-n-gpu pip install tf-nightly-gpu