Get ready:
System environment: WINDOWS10 + Anaconda3 + pycharm
(1) environment configuration:
Open Anaconda Prompt, enter the Tsinghua warehouse image, so the update will be faster:
Input:
Conda config--add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/--set show_channel_ URLs Yes
Also in Anaconda Prompt use Anaconda to create a python3.5 environment, the environment name is TensorFlow, enter the following command:
Conda create-n TensorFlow python=3.5
Run 开始菜单 ->Anaconda3—>Anaconda Navigator
, click on the left side Environments
and you can see tensorflow
that the environment has been created well.
Start the TensorFlow environment in Anaconda prompt:
Activate TensorFlow
Note: When TensorFlow is not used, the TensorFlow environment is closed and the command is:deactivate(返回默认的python 3.6环境)
(2) Installation TensorFlow
Command line activate TensorFlow first
Activate TensorFlow
Input command: Pip install Tensorflow-gpu after a long wait
This time, although TensorFlow has been installed, we also need to install Cuda and CUDNN (accelerated libraries specifically for deep learning) because of the need for GPU acceleration.
(3) Install Cuda, point me point me, install directly click Next
According to their own environment to choose the corresponding version, EXE divided into the network and local version, the network version of the installation package is relatively small, the installation of the time to download the required package; The local version of the installation package is a direct download of the full installation package. Download local version is recommended here
(4) installation point of CUDNN Library I dot me, this is more cumbersome, need to fill out a number of questionnaires, download compression package
After downloading CUDNN compressed package, unzip,
That's it.
The following command line tests whether TensorFlow can run, entering the Python environment under the Anaconda Prompt/cmd command, and entering it row by line:
Import= tf.constant ("hello! TensorFlow"= TF. Session ()print(sess.run (hello))
The output is:
b'Hello tensorflow'
(6)
using TensorFlow in Pycharm
After the new project in File-setting–project interpreter select the Python interpreter under TensorFlow
Just run a HelloWorld and test it.
Import= tf.constant ("hello! TensorFlow"= TF. Session ()print(sess.run (hello))
Console output:
b'Hello tensorflow'
The benefit of this approach is that you do not have to open and close the environment every time (activate TensorFlow, deactivate TensorFlow).
(7) TensorFlow test Next:
① Official Tutorial Code test:
# creates a graph. A = Tf.constant ([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a'= Tf.constant ([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b'= Tf.matmul (A, b) c11>#creates a session with Log_device_placement set to True. Sess = tf. Session (CONFIG=TF. Configproto (log_device_placement=True)#Runs the op. Print Sess.run (c)
Output:
Device Mapping:/job:localhost/replica:0/task:0/gpu:0-0000:05:00.0/job:localhost/ replica:0/task:0//job:localhost/replica:0/task:0//job:localhost/replica:0/task:0/ . 64.]
②example Test
Detailed Reference Blog http://blog.csdn.net/sb19931201/article/details/53648615//
Just contact deep learning, not how to understand, first installed on the sharp weapon ~_~ welcome you have problems to advise.
Reference:
1. http://m.blog.csdn.net/u012052268/article/details/74202439
2. http://blog.csdn.net/sb19931201/article/details/53648615//
3. Http://blog.csdn.net/hdd0411/article/details/71305931?locationNum=8&fps=1
Win10 under TensorFlow GPU Edition installation