This article directory
Introduction based on Anaconda tensorflow install 1 download Linux version of Anaconda installation package 2 Install Anaconda use Anaconda installation TensorFlow 1 establish a Conda computing environment 2 activation environment using Conda installation TensorFlow 3 Installation TensorFlow 4 How to use TensorFlow in Jupyter summary use Docker installation TensorFlow 1 Install Docker 2 Create TensorFlow image some minor problem records during installation
1. Introduction
TensorFlow = Tensor (vector) +flow (stream) = "tensor flows through network diagrams".
Main reference:
[1] TensorFlow official website Tutorials
[2] The translation of the TensorFlow official website course by the Geek College
The official offers 5 ways to install TensorFlow: Pip install:install TensorFlow on your machine, possibly upgrading previously installed Python PA Ckages. May impact existing Python programs on your machine. Virtualenv Install:install TensorFlow in it own directory, not impacting any existing Python programs on your machine. Anaconda Install:install TensorFlow in its own environment for those running the Anaconda Python distribution. Does not impact existing Python programs on your machine. Docker Install:run TensorFlow in a Docker container isolated to all other programs on your machine. Installing from Sources:install TensorFlow by building a PIP wheel this you then the using PIP.
A few notes:
1. Because it can be invoked directly in Python when using TensorFlow, it is decided to use Python to learn TensorFlow
2. Using Python,jupyter Notebook is an indispensable tool, so this article will also document how to install Jupyter under Ubuntu
3. The main installation of the python2.7 version of the relevant components 2. Anaconda based TensorFlow installation 2.1 Download Linux version of Anaconda installation package
Download Address: Https://www.continuum.io/downloads, such as the foreign web site can not be accessed or the Internet is too slow to visit the mirror of Tsinghua University https://mirrors.tuna.tsinghua.edu.cn/ anaconda/archive/
Here's the 64-bit Linux version of Python 2.7.
Click to download, download complete, get anaconda2-4.0.0-linux-x86_64.sh installation files (download the file in the system user's Downloads folder, my system path is/home/tensorflow/downloads/) 2.2 Installation Anaconda
Open terminal, type the following command, and then enter
bash/home/tensorflow/downloads/anaconda2-4.0.0-linux-x86_64.sh
The/home/tensorflow/downloads/here is the path where the anaconda2-4.0.0-linux-x86_64.sh is stored (the/home/tensorflow of the system for which the Linux system is created is the path of the user , TensorFlow for System user name)
Read license, step by step back to read (appear more by return to look down)
Enter Yes to accept license
Set the installation path, use the default installation path, and enter directly into the carriage
Start the automatic installation process
As shown in the following illustration: Verify that the Anaconda installation path is added to the environment variable, be sure to enter Yes, otherwise adding environment variables can be tricky.
Here must be noted:
If the step does not select Yes during the installation, the Anaconda installation path is not added to the environment variable, and the following information appears when the installation is complete:
Do your wish the installer to prepend the Anaconda2 install location
To PATH in YOUR/HOME/TINGTING/.BASHRC? [Yes|no]
[No] >>>
You could wish to edit your. BASHRC or prepend Anaconda2 install:
$ export Path=/home/tingting/anaconda2/bin: $PATH
Thank for installing anaconda2!
At that time also did not pay attention to this information, no tube, the results after the installation of Anaconda, found that can not use, just notice this information, the original, Anaconda bin Path has not been added to the PAHT environment variables, so you need to enter the following command line:
Export Path=/home/tingting/anaconda2/bin: $PATH
The Anaconda bin path is added to the environment variable path
Installation Complete
As you can see here, notebooks and some Python packages have been successfully installed, but for changes to the environment variables, a new terminal must be opened to take effect, otherwise the relevant instructions will not be recognized
After configuring the environment variable, open the new terminal, enter the Conda Info command to view the installation information, enter the Conda List command to query what Python libraries are installed, commonly used python,numpy,scipy, etc. If you find anything not installed, you can run Conda install * * * To install (here * * * Represents the name of the Python package you want to install), and if a package is not up to date, you can run Conda update to the latest version.
Open a new terminal, enter Jupyter notebook, and find that Jupyter was successfully installed
Open Browser: Http://localhost:8888/tree (you can see kernel with Python 2 installed)
3. Establish a Conda computing environment using Anaconda installation TensorFlow 3.1
Create a Conda environment called TensorFlow:
Conda create-n TensorFlow python=2.7
3.2 Activate the environment, use Conda to install TensorFlow
Activate the environment and use PIP to install TensorFlow inside it.
SOURCE Activate TensorFlow
3.3 Installation TensorFlow
Installation
Pip Install--ignore-installed--upgrade https://storage.googleapis.com/tensorflow/linux/cpu/ Tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl
Before installing TensorFlow under UBUTNU in the virtual machine, in this step toss for 2 days, is not successful, each time is timeout and other problems, this time on the dual system of the machine, the moment is installed, I really do not know before the failure is due to the virtual machine or the speed of the problem
After the successful installation, each use of tensorflow need to activate the Conda environment, you can see, under normal circumstances, is the Anaconda bin path in the environment variable, but the activation of the Conda-tensorflow environment, The environment variable stores the bin path under TensorFlow
If the above link cannot be accessed or the installation is unsuccessful, you can execute the Anaconda search-t Conda tensorflow command on the Linux system terminal, which TensorFlow installation package, Select the appropriate version through the specific version and the applicable platform information. Then copy the name of the TensorFlow installation package you want to select above, assuming the installation is Ijstokes/tensorflow, you can go through Anaconda show ijstokes/ TensorFlow command to view the details of the package where the link and installation commands, copy returned to the installation command input terminal, where the installation command for Conda install--channel https://conda.anaconda.org/ Ijstokes TensorFlow, you can install according to the specific installation package.
Note: If you have a GPU version of TensorFlow installed above, you will also need to install Cuda (Compute Unified Device Architecture). Cuda is the computing platform that the graphics manufacturer Nvidia introduced. Cuda™ is a general-purpose parallel computing architecture introduced by NVIDIA, which enables the GPU to solve complex computational problems. It contains the CUDA instruction set architecture (ISA) and the parallel computing engine within the GPU. How to install Cuda
1. First confirm that your computer installed Nvidia graphics card, the current Cuda only support Nvida graphics card, does not support Amd/ati graphics card (AMD OpenCL support is very good, I did not pay attention to the installation of the graphics card, toss a day or two, found that the fatal problem, hint no Module Nvidia, when looking back to look at its own graphics card found to be AMD type, only to think of is not supporting AMD's graphics card, for a long time in vain. In Device Manager, you can view the video card information. As the following illustration shows, the graphics card with Nvidia can be installed.
2. Download the CUDA Toolkit on the NVIDIA Web site, note that it is windows, and need to see whether it is a laptop or a desktop installation package, download a notebook installation kit, named Cuda_5.0.35_winvista_win7_win8_ Notebook_32-3, (cuda5.5 similar) double-click to open the installation, and follow the prompts to install, in the process, it will also update Nvidia's graphics driver. After the
3.CUDA Toolkit is installed, we also need to confirm that Cuda is properly installed, we can first check the NVCC compiler for proper installation, enter in the command Prompt window: nvcc-v, and return to see if there is any version information. If the version information appears, it proves that the NVCC installation was successful,
4. More generally, we will run the command line at C:\ProgramData\NVIDIA Corporation\cuda samples\v5.0\bin\win32\ Release in the Devicequery program, if you can detect Cuda device The program has been properly installed
Official website address for Https://developer.nvidia.com/cuda-downloads, select the operating system, architecture system, version, installation type parameters, and then click Download. After downloading, after the terminal terminal to downloads, follow the three installation commands shown in the following illustration to install. Specific GPU version of the TensorFlow how to install in the CENTOS7 64-bit system, you can refer to http://blog.csdn.net/wang2008start/article/details/71319970 and http:// Www.cnblogs.com/evempire/p/5620609.html. The Add environment variable mentioned therein, my virtual machine is under the path/etc/profile, enter Vi/etc/profile in the terminal to add the following two statements.
Export path=/usr/local/cuda-8.0/lib64: $PATH
Export ld_bibrary_path=/usr/local/cuda/lib64: $LD _library_path
Use the following command to change the effect and test
Source/etc/profile//Immediate effect
nvcc-v//Check Cuda
Yum Install CMake//installation CMake
Cd/usr/local/cuda-8.0/samples
make//Test Cuda
Test time is longer, some time without error can be aborted.
Test whether the TensorFlow is installed successfully
(1) Activates the Conda environment
(2) Enter python
(3) import tensorflow
The whole process is smooth, TensorFlow was successfully import
3.4 How to use TensorFlow
in Jupyter