Install tensorflow under Anaconda (windows system)

Because Anaconda and python have been installed before (you can read the previous article Anaconda super detailed installation tutorial (in Windows environment)_fan18317517352's blog-CSDN blog (I am a technical novice, if there is any error, please correct me.) Description: In fact, if you install Anaconda, you don’t need to install Python separately. But, I feel that most people have already installed Python, because they usually come into contact with python first, and then install Python directly. Important, it does not affect your installation of Anaconda today. This is the python I installed before: Let’s start the topic: 1. Anaconda download: Generally, there are two options, one is the official website, and the other is the domestic mirror website (recommended to choose this) Everyone knows the former, and the speed is touching, so... https://blog.csdn.net/fan18317517352/article/details/123035625

You need to pay attention to the installation of CUDA and CUDNN. You can refer to the installation of CUDA and CUDNN under win10 of this great god (super detailed)! The pro-test is effective! _u010618587's blog-CSDN blog_cuda installation CUDA8 installation configuration CUDA8 installation package can be downloaded directly from NVIDIA official website. According to the corresponding system options, I chose cuda_8.0.61_win10.exe (size is 1.3G), and it is recommended to choose custom instead of "simplified" when installing (as can be seen from the English explanation below, in fact, the simplified here is written as Complete should be more appropriate, he will install all components and overwrite the existing driver, but I don't want to install the whole family barrel, not to mention that my official graphics card driver is newer than his). As shown in the figure below, we only need to select CUDA below... https://blog.csdn.net/u010618587/article/details/82940528

Open Anaconda, select CMD.exe Prompt, and click Launch.

 Enter this interface, the default (base) in front is the root mode

Enter the following code to create the environment

conda create --name tensorflow python=3.8

 Press y and wait for the installation

 Enter conda info --envs to check whether the environment installation is successful, just to see if there is tensorflow below.

 then type

activate tensorflow

Enter the tensorflow environment, look at the arrow, from base--->tensorflow

 It is recommended to run python -m pip install --upgrade pip first to upgrade the pip version, so as not to make mistakes like mine.

 Enter pip install --ignore-installed --upgrade tensorflow-gpu==2.6.0 to install. Will fail many times, try a few more times. If not, you can use mirror installation.

pip install tensorflow-gpu==2.5.0 -i https://pypi.doubanio.com/simple

 

Test whether the installation is successful

, enter python 

 

Enter the following test example 

import tensorflow as tf
tf.compat.v1.disable_eager_execution() 
hello = tf.constant('hello,tensorflow')
sess= tf.compat.v1.Session()
print(sess.run(hello))

 success

 test in pycharm

, this is an error, because the interpreter has not been changed. 

 Replacement steps

 

 

Guess you like

Origin blog.csdn.net/fan18317517352/article/details/123042586