Installation tensorflow-gpu2.0 (windows)

anaconda installation op a https://www.cnblogs.com/wintersoft/p/11609188.html

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
open Anaconda-Navigator-> Environments-> base ( root) to modify the python version 3.6.8
python3.7 currently not supported on tensorflow2.0

Creating the environment
to create environment called tensorflow-gpu in Anaconda in
conda create -n tensorflow-gpu python = 3.6.8
enter tensorflow-gpu environment
activate tensorflow-gpu enter tensorflow-gpu environment

View Anaconda in the environment
conda info --envs

Check the new environment python version
python --version


Perform the following two lines in the first cmd in
easy_install pip
upgrade pip - pip install
configure the pip install pip -U # pip upgrade to the latest version (> = 10.0.0)
set the domestic source
pip config set global.index-url https : //pypi.tuna.tsinghua.edu.cn/simple
file address in C: \ Users \ Administrator \ AppData \ Roaming \ pip \ pip.ini

Back Anaconda Prompt
installation pylint
PIP3 install pylint

pip3 install --upgrade -I setuptools
otherwise might later report ImportError: No module named 'tensorflow'
This was wrong on the Internet there is a solution:
the python default third-party libraries installation path (only for the people to Anaconda installation said \ Anaconda3 \ Lib \ site-packages , install the official release version is also similar directory) to create a new path.pth document, written on the inside position on your tensorflow installed (location can pip show tensorflow View)

先安装tensorflow
pip3 install --upgrade --ignore-installed tensorflow --default-timeout=100

pip3 install tensorflow-gpu==2.0.0或
pip3 install --upgrade --ignore-installed tensorflow-gpu==2.0.0
如果报错超时,延长超时时间
pip3 install --upgrade --ignore-installed tensorflow-gpu==2.0.0 --default-timeout=100
pip3 install --upgrade --ignore-installed tensorflow-gpu --default-timeout=100

还需安装Visual C++ Redistributable for Visual Studio 2015
https://download.microsoft.com/download/6/D/F/6DF3FF94-F7F9-4F0B-838C-A328D1A7D0EE/vc_redist.x64.exe

There is another anaconda installation conda install xxx slower but more detailed version
first with conda search tensorflow and conda search tensorflow-gpu to query all those versions
conda install tensorflow-gpu == 2.0.0

Install CUDA and CUDDN
sure the video card must be NVDIA's
in C: \ ProgramData \ Anaconda3 \ Lib \ site-packages \ tensorflow \ python \ build_info.py file platfor in need of cuda and you can see the version number cudnn
CUDA
graphics card models support: https://developer.nvidia.com/cuda-gpus
CUDA Download: https: //developer.nvidia.com/cuda-toolkit-archive Thunder can download
cuDNN Download: https: //developer.nvidia.com/rdp / cudnn-download Thunder download non-
supplemented cuda, the more simple installation, just need to compress the file download decompression, respectively cuda / include, cuda / lib, cuda / bin directory three copy the contents of C : \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 corresponding include, lib, the bin directory.

C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ bin nvcc.exe have lower installation was successful
C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ have under extras \ CUPTI \ libx64 cupti64_100.dll successful installation instructions CUPTI


Add environmental variables and cudnn CUPTA path
CUDA_PATH = C: \ Program Files \ the NVIDIA the GPU Computing Toolkit \ the CUDA \ v10.0
the Path variables added:
% CUDA_PATH%
%% CUDA_PATH \ bin
% CUDA_PATH% \ libnvvp
% CUDA_PATH% \ Extras \ CUPTI \ lib64
remember to log off or reboot

Enter cmd command nvcc -V note uppercase V

 

After installation, you can be tested, input Prompt
Python -C "Import OS; Inspect Import; Import tensorflow; Print (os.path.dirname (inspect.getfile (tensorflow)))"

Another way
IPython
Import tensorflow AS TF
references tensorflow package, if there is no error, the installation was successful.
If the message ModuleNotFoundError: No module named 'tensorflow' because pip installation different from the other, will not rely on tensorflow also followed to install when you install tensorflow-gpu.
View tensorflow version
tf .__ version__
view tensorflow installation path
tf .__ path__
View keras version
tf.keras .__ version__


If the IDE in PyCharm:
File-> Settings-> Project: Project name -> Interpreter Project
1, Project Interpreter-> Show All -> + Existing Environment-> Interpreter selected ... join C: \ ProgramData \ Anaconda3 \ envs \ tensorflow-gpu \ python.exe

Without anaconda installation method is: After setting python.exe return to Project Interpreter interface + Search tensorflow installation tensorflow-gpu 2.0

Test
IPython
Import tensorflow AS TF
tf.test.is_gpu_available ()
If the True, explained gpu version has been installed successfully
tf.test.gpu_device_name ()

Guess you like

Origin www.cnblogs.com/wintersoft/p/11620267.html