Regarding TensorFlow installation, there are many ways to practice. This article will give you a detailed introduction on how to install TensorFlow using pip.
Available installation packages
tensorflow — CPU-only current version (recommended for beginners)
tensorflow-gpu — the current version that supports GPU (Ubuntu and Windows)
tf-nightly —Nightly is built only for CPU (unstable)
tf-nightly-gpu — Use GPU to support Nightly (unstable, Ubuntu and Windows)
System Requirements
Ubuntu 16.04 or higher (64-bit)
macOS 10.12.6 (Sierra) or higher (64-bit) (no GPU support)
Windows 7 or higher (64-bit) (Python 3 only)
Raspbian 9.0 or higher
Hardware requirements
Starting from TensorFlow 1.6, binary files use AVX instructions, which may not run on older CPUs
Read the GPU support guide (https://tensorflow.google.cn/install/gpu?hl=zh-CN) and set up a GPU card that supports CUDA® on Ubuntu or Windows
Install the Python development environment on the system
Python 3
Check if your Python environment is configured:
Requires Python 3.4, 3.5 or 3.6
$ python3 --version$pip3 --version$virtualenv --version
If these packages are already installed, skip to the next step.
Otherwise, please install Python, pip package manager and Virtualenv:
UBUNTU
$sudo apt update$sudo apt install python3-dev python3-pip$sudo pip3 install -U virtualenv # system-wide install
MAC OS
Install using Homebrew package manager:
$/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"$export PATH="/usr/local/bin:/usr/local /sbin:$PATH"$brew update$brew install python # Python 3$sudo pip3 install -U virtualenv # system-wide install
WINDOWS
Install 2015 Redistributable Update 3. This is included with Visual Studio 2015 and can be installed separately:
Go to Visual Studio to download
Choose Redistributables and Build Tools
Download and install Microsoft Visual C++ 2015 Redistributable Update 3
Install the 64-bit Python 3 distribution for Windows (select pip as an optional feature)
C:\>pip3 install -U pip virtualenv
RASPBERRY PI
$sudo apt update$sudo apt install python3-dev python3-pip$sudo apt install libatlas-base-dev # required for numpy$sudo pip3 install -U virtualenv # system-wide install
OTHER
$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py$python get-pip.py$sudo pip3 install -U virtualenv # system-wide install
Python 2.7
Check if your Python environment is configured:
$python --version$pip --version$virtualenv --version
If these packages are already installed, skip to the next step.
Otherwise, please install Python, pip package manager and Virtualenv:
UBUNTU
$sudo apt update$sudo apt install python-dev python-pip$sudo pip install -U virtualenv # system-wide install
MAC OS
Install using Homebrew package manager:
$/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"$export PATH="/usr/local/bin:/usr/local /sbin:$PATH"$brew update$brew install python@2 # Python 2$sudo pip install -U virtualenv # system-wide install
RASPBERRY PI
$sudo apt update$sudo apt install python-dev python-pip$sudo apt install libatlas-base-dev # required for numpy$sudo pip install -U virtualenv # system-wide install
OTHER
$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py$python get-pip.py$sudo pip install -U virtualenv # system-wide install
Create a virtual environment (recommended)
The Python virtual environment is used to isolate the package installation from the system.
UBUNTU / MAC OS
Create a new virtual environment by selecting the Python interpreter and creating a ./venv directory:
$virtualenv --system-site-packages -p python2.7./venv
Activate the virtual environment using shell-specific commands:
$source ./venv/bin/activate # sh, bash, ksh, or zsh
When virtualenv is active, the shell prompt is prefixed with (venv).
To install the software package in a virtual environment without affecting the host system settings. First upgrade pip:
(Venv)$pip install --upgrade pip(venv)$pip list # show packages installed within the virtual environment
Then exit virtualenv:
(Venv)$deactivate # don't exit until you're done using TensorFlow
WINDOWS
Create a new virtual environment by selecting the Python interpreter and creating a ./venv directory.
Activate the virtual environment:
(Venv)C:\>.\venv\Scripts\activate
Installing the software package in the virtual environment will not affect the host system settings. First upgrade pip:
(Venv)C:\>pip install --upgrade pip(venv)C:\>pip list # show packages installed within the virtual environment
Then exit virtualenv:
(Venv) C:\> deactivate # don't exit until you're done using TensorFlow
CONDA
We recommend using the pip package provided by TensorFlow, or the Anaconda package supported by the community.
Create a new virtual environment by selecting the Python interpreter and creating a ./venv directory:
$conda create -nvenvpip python=2.7
Activate the virtual environment:
&source activatevenv
In the virtual environment, install the TensorFlow pip package using its full URL
(Venv)$pip install --ignore-installed --upgrade packageURL
Then exit virtualenv:
(Venv)$source deactivate
Install TensorFlow pip package
Choose one of the following TensorFlow packages from PyPI to install:
tensorflow—current version of CPU only (recommended for beginners)
tensorflow-gpu — the current version that supports GPU (Ubuntu and Windows)
tf-nightly— Nightly is built only for CPU (unstable)
tf-nightly-gpu — Use GPU to support Nightly (unstable, Ubuntu and Windows)
Package dependencies are installed automatically. All are listed in the setup.py file under REQUIRED_PACKAGES.
VIRTUALENV INSTALL
(Venv)$ pip install --upgrade tensorflow
Verify the installation:
(Venv)$python -c "import tensorflow as tf; print(tf.__version__)"
SYSTEM INSTALL
$ pip install --user --upgrade tensorflow # install in $HOME
Verify the installation:
$python -c "import tensorflow as tf; print(tf.__version__)"
Success: TensorFlow is now installed. Read the tutorial and get started. (Https://tensorflow.google.cn/tutorials/?hl=zh-CN)
Installation package location
Some installation mechanisms require the URL of the TensorFlow Python package. The value you specify depends on your Python version.
Version | URL |
Linux | |
Python 2.7 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp27-none-linux_x86_64.whl |
Python 2.7 GPUsupport | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp27-none-linux_x86_64.whl |
Python 3.4 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp34-cp34m-linux_x86_64.whl |
Python 3.4 GPUsupport | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp34-cp34m-linux_x86_64.whl |
Python 3.5 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp35-cp35m-linux_x86_64.whl |
Python 3.5 GPUsupport | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp35-cp35m-linux_x86_64.whl |
Python 3.6 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp36-cp36m-linux_x86_64.whl |
Python 3.6 GPUsupport | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp36-cp36m-linux_x86_64.whl |
macOS (CPU-only) | |
Python 2.7 | https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.11.0-py2-none-any.whl |
Python 3.4, 3.5, 3.6 | https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.11.0-py3-none-any.whl |
Windows | |
Python 3.5 CPU-only | https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.11.0-cp35-cp35m-win_amd64.whl |
Python 3.5 GPUsupport | https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.11.0-cp35-cp35m-win_amd64.whl |
Python 3.6 CPU-only | https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.11.0-cp36-cp36m-win_amd64.whl |
Python 3.6 GPUsupport | https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.11.0-cp36-cp36m-win_amd64.whl |
Fiber Optic Distribution Box,Fiber Optic Breakout Box,Fibre Optic Breakout Box,Fibre Break Out Box
Cixi Dani Plastic Products Co.,Ltd , https://www.danifiberoptic.com