TensorFlow study notes (c) - linux installation TensorFlow

Referring to the official documentation https://www.tensorflow.org/get_started/os_setup.html
we can use pip to install tensorflow
because dependent python, and there python2 and python3 points, so install virtualenv
can easily get in and python3 python2.7 before dynamic switching
sudo pip install virtualenv


activation environment
the virtualenv --system-Site-Packages ~ / Tensor
CD ~ / Tensor /
the bash then
source bin / activate
if the csh source bin / activate.csh
Note that this step be performed each time tensorflow It should be performed when


there pip and pip3 a difference, I use python3 version
Note that if the gpu also install CUDA9.0 kit, NVIDIA drivers associated with the CUDA 9.0 Toolkit, cuDNN v7.0 , libcupti-dev library
sudo pip3 install --upgrade tensorflow-gpu
If no gpu is
sudo pip3 install --upgrade tensorflow
If python2 put into pip above pip3


exit environment
deactivate


Carrying out tensorflow be unloaded, the back of which corresponds to the front tensorflow-gpu installed, if the rear belt gpu - GPU
the sudo PIP3 Uninstall tensorflow-gpu


source compiler tensorflow
mounted java-1_8_0-openjdk
mounting bazel This can be either directly from the source system installation
If you want to compile bazel will have to install the java 8 jdk, not openjdk-8 may be other versions of
the source code method:
from
https://github.com/bazelbuild/bazel/releases
download the latest version, I was under the bazel-0.13 dist.zip-.0
mkdir Bazel
cd Bazel
the unzip -x bazel-0.13.0-dist.zip
bash ./compile.sh
can refer to the official https://docs.bazel.build/versions/master/install.html


git https://github.com/tensorflow/tensorflow clone 
CD tensorflow
./configure
Bazel Build --config = opt --config = // tensorflow CUDA / Tools / pip_package: build_pip_package
bazel-bin / tensorflow / tools / pip_package / build_pip_package / tmp / tensorflow_pkg ( generated corresponding in / tmp tensorflow_pkg below / directory .whl *)
the sudo the install /tmp/tensorflow_pkg/tensorflow-YOUR-VERSION.whl PIP
above - config = cuda remove the CPU version is compiled

This part is disposed tensorflow, and then generate whl installation tensorflow. 
Personal understanding: Direct pip installation is to install the official website provides the configured whl package, and install the source code is compiled after use bazel generate whl package, then install it.

: Verify normal installation
ZM-Linux @ kl9l (Tensor): ~ / Tensor> to python3
the Python 3.6.5 (default, 31 is-Mar 2018, 19:45:04) [the GCC] ON Linux
the Type "Help", "Copyright", "Credits" or "License" for More Information.
>>> Import tensorflow AS TF
>>> 


other reference
https://blog.csdn.net/wenanshi/article/details/73484688
https://blog.csdn.net/ u012436149 / Article This article was / the Details / 53,312,212
http://vividfree.github.io/%E5%B7%A5%E5%85%B7%E5%AE%89%E8%A3%85/2017/04/13/install- -ON-Linux-tensorflow from-Sources
http://wiki.jikexueyuan.com/project/tensorflow-zh/get_started/os_setup.html

Remarks:

After the release 1.TensorFlow 1.2, it requires Python version 3.5 or more,

2. pip-based installation, required XXXX.whl, required over the wall, or to download to the following address:

https://github.com/mind/wheels

Published 48 original articles · won praise 121 · views 680 000 +

Guess you like

Origin blog.csdn.net/guoyunfei123/article/details/82429193