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.
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. (On macOS or Linux, use the default bash shell.)
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 only CUDA 9.0 is supported. On Linux CUDA 8.0, 9.0, and 9.2 are supported, and 9.2 is the default.
To install GPU TensorFlow with a non-default CUDA version such as 8.0:
conda create -n tf-gpu-cuda8 tensorflow-gpu cudatoolkit=8.0 conda activate tf-gpu-cuda8
We recommend Python 3, but it is possible to use TensorFlow with Python 2 on Linux or 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