Anaconda installs the deep learning framework tensorflow_Summary


I have read many tutorials on installing the deep learning environment tensorfow on the Internet. Many of them need to be installed through Anaconda and using domestic image sources, and there are many version mismatch problems.
After many installations, I summarized the simple installation method (currently available), as well as the corresponding library version issues that need to be paid attention to.
The installation environment is as follows:

library or environment Version
Tf 1.9.0
Py 3.6
Hard 2.2
Gdal 2.4
Opencv 4.5
Numpy 1.19
Matplotlib 3.3.4
Cuda 9.0
hidden 7.6

All libraries in this environment can be used, and there is no version mismatch problem.

1. Install Anaconda

Anaconda recommends downloading and installing a higher version.
Use the Tsinghua University open source software mirror station to download.
Website:
Index of /anaconda/archive/ | Tsinghua University Open Source Software Mirror Station | Tsinghua Open Source Mirror

2. Create a python virtual environment

1. Commonly used commands in conda

1)conda list 查看安装了哪些包。在环境下

2)conda env list 或 conda info -e 查看当前存在哪些虚拟环境

3)conda update conda 检查更新当前conda

2. Install virtual environment

In the cmd window:
use conda create -n your_env_name python=XX (2.7, 3.6, etc.) anaconda command to create a virtual environment with python version XX and name your_env_name. Your_env_name file can be found under the envs file in the Anaconda installation directory.

Specify the python version as 2.7. Note that you need to specify at least the python version or the package to be installed. # In the latter case, the latest python version will be automatically installed
conda create -n env_name python=2.7

Also install the necessary packages
conda create -n env_name numpy matplotlib python=2.7

Note: You can use anaconda to install the necessary packages, but the installation process is slow and unstable network may cause failure! ! ! ! ! So you can install it using pycharm

3. Activate/switch virtual environment

Windows: Use the code activate your_env_name (virtual environment name)
to install the package in the environment!

After creating the new environment, no longer use Anaconda , directly open the new environment in Pychram and continue the installation.

3. Install cuDNN and CUDA

Check the computer configuration, check the graphics card configuration, and go to the official website to download the corresponding versions of cuDNN and CUDA.
Note: You need to determine the gpu or cpu version, and determine the tf version you want to install.
insert image description here

insert image description here
Download and install

CUDA download: CUDA Toolkit Archive | NVIDIA Developer official website, download the corresponding version
cuDNN download: cuDNN Archive | NVIDIA Developer official website, download the corresponding version
After the CUDA download is completed, start the installation and select the corresponding computer information. After the installation is complete, you can download cuDNN.
After the download of cuDNN is completed, open the folder where it is located and copy the bin, include, and lib folders to the corresponding CUDA folders.

4. Install tensorflow and related libraries (using pycharm)

At present, pycharm can install tensorflow, and it is quick and easy.
The first step: add the interpreter environment, that is, the virtual environment created by yourself using anaconda.
The second step: install the corresponding version of tensorflow and other libraries in the interpreter settings.
insert image description here

5. Attention

Installation of GDAL

Using anaconda or Pycharm to install GDAL failed. Here, first download GDAL to the corresponding location of the environment , and then use pycharm to install it.
pip install GDAL-2.4.1-cp36-cp36m-win_amd64.whl

Matplotlib installation

At present, the latest version installation fails, you can reduce the version installation

numpy version replacement

The numpy corresponding to tf2.0 cannot be too high, and a lower version needs to be switched.

Guess you like

Origin blog.csdn.net/weixin_51205206/article/details/119952481