当前位置:网站首页>Anaconda+tensorflow most effective summary version (blood and tears summary of 6 reloads)

Anaconda+tensorflow most effective summary version (blood and tears summary of 6 reloads)

2022-06-11 08:12:00 Xiongkairui

One 、 Download and install Anaconda

1、 Download from the official website Anaconda

(1)Anaconda Downloading and installing is very simple , First, download the corresponding version of your computer from the official website Anaconda.
The address is :Anaconda resources —— Tsinghua University open source software image station . Click to download from the open source software mirror station of Tsinghua University Anaconda The software .

because , The software distribution is not displayed in a timeline , So if you want to find the latest version , I'm going to have to search for it myself .

2、 install Anaconda Software

(1) Download it Anaconda The software can be formally installed .
First , Click on Anaconda Corresponding .exe After the document , There will be
 Insert picture description here
Just click next That's all right. , There is nothing to pay attention to .

(2) This is an agreement , Click on I Agree To download , Otherwise, you can't download it .
 Insert picture description here
(3) Here I recommend (ALL Users, All users can use ), But it requires administrator rights , After choosing directly , Click on Next That's all right. .
 Insert picture description here

(4) This is to choose the installation location , I recommend choosing the default location , That is to say C disc , Because it will avoid a lot of trouble , If you want to install in D Disc or E disc , Later, when operating the software , Permission problems may occur , For example, download things halfway down , All of a sudden, an error was reported , The reason is that the permissions are insufficient. You need to add permissions to the folder . Of course, I've always been in C disc , The above problems , I'm not sure it will happen , But just follow it .( Be careful : The file storage location must not have Chinese
 Insert picture description here
(5) Here I recommend choosing directly The second option That's all right. , The first option is that the software automatically adds the environment , But the comparison pit , There will be problems when using or performing some operations in the future . If you want to be safe , I suggest not checking the first option , The trouble is that there's a little trouble , But it's better than unloading and reloading later , Of course, you should make your own choices .
 Insert picture description here
(6) Click on Install Then you can officially start downloading .
 Insert picture description here
(7) When it's finished downloading , Click on next That's all right. .
 Insert picture description here
thus Anaconda The software has been officially downloaded .

3、 To configure Anaconda Environmental Science

(1) Configuring the environment is also simple , Right click This computer , Click on attribute , And then choose Advanced system setup , Click on the environment variable , Re selection System variables In this big frame path, Click edit , You can add the corresponding environment variables .
 Insert picture description here
(2) The screenshot of environment variables is as follows , Just add the code in the red box ,path End of path configuration ( This is my installation path , If you add a path , Please also focus on reality ).
 Insert picture description here
(3) Re edit PATHEXT, Add... After it ==.DLL==. The reason is that I called tensorflow when , An error again , The reason is that it cannot be resolved DLL file , Then I looked up a lot of information , To solve this problem , Of course, if you haven't met , Then ignore , If you also encounter this problem , Plus, it's not too late .( Other bloggers don't have this step ).
 Insert picture description here

4、 test Anaconda Is the installation successful

Inquire about Anaconda Version number of .

conda --version

The following version number indicates that the installation was successful .
 Insert picture description here
Be careful : I still recommend using Run the command window as an administrator , It's important , If you use ordinary users , After subsequent installation tensorflow There may be problems when , That is, there is a permission problem , Therefore, for convenience, it is recommended to use administrator privileges .
Besides , Some bloggers may suggest an update Anaconda Software , Here I do not recommend , Because after I update , Find out Anaconda3 Inside Spyder It can't be used , The reason is that I update Anaconda After software , It's different from the original Spyder Version mismatch and other problems , I can't solve , I had to reinstall this software .

thus , install Anaconda The steps are really over .

5、 Completely and cleanly uninstall Anaconda Software

If you install Anaconda Or subsequent installation tensorflow There was a problem , Or to the point where there is no solution , Can only be refitted , Then you can perform the next steps .
(1) First of all Run as Administrator Anaconder Prompt window . Then input

conda install anaconda-clean

After downloading , There is no mistake , Re execution

anaconda-clean

All the way y, That's all right.
It will recycle and package some things of your software into folders , You can find this folder , Delete it .
(2) Then directly run the... Under its installation directory Uninstall-Anaconda3.exe that will do .
(3) Finally, delete the invalid shortcut .
(4) Finally, modify the information in the environment variable . It was basically cleaned up .

Two 、 Download and install tensorflow

1、 see anaconda The existing environment

conda env list

I have manually configured two environments here , One is python3.7 Version environment , The other one is python3.8 Version environment
 Insert picture description here
Generally, it is not equipped before , Only base Environmental Science .
Be careful : Only configure the corresponding first python Environmental Science , To download tensorflow. Otherwise, in the base Download in the environment , There will be big problems in the future .

2、 Create corresponding bearer tensorflow Of python Environmental Science

(1) First , To configure the corresponding download source , I use domestic sources , Or use foreign sources , There may be errors .

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

Copy this code directly , And then to Administrator status function Anaconda Prompt window , Then paste and run .

(2) After the top is finished
With my configuration python3.7 As an example , Execute this code

conda create --name python37 python=python3.7

You can python37 The environment . Because I was equipped with , No screenshots , But generally there will be no error .
( Generally, other bloggers will recommend python3.8 The above version of the environment , So I also created python3.8 Environment , As for why I should do python3.7 Environment , because tensorflow2.0 The above version is not easy to use , And many modules have been deleted before , I had to find a lower version tensorflow, That is to say 2.0 Version below )

(3) After creating the environment , You can use the command to activate the environment , Only after activating the environment , Install again tensorflow Only insurance .

activate python37

If this happens, it means success .
 Insert picture description here
(4) Out of the environment

conda.bat deactivate

3、 Download and install tensorflow

(1) General download tensorflow2.0 For versions above, you can activate the environment directly , Use the following command

pip install tensorflow==2.5

Or other versions .
Generally, you can download it after a panic attack .

If you want to download through that command tensorflow2.0 The following version , This order will not work , because tensorflow The default source of has no lower version tensorflow 了 .( Then I also referred to nearly 30 Many blogs written by bloggers , Experiment n Time , In the end, this method succeeded )

(2) Download lower version tensorflow
First open the URL :Python Plug in network
 Insert picture description here
Search for tensorflow after , Click on the latest version of tensorflow
 Insert picture description here
Then find the old version , Click in
 Insert picture description here
Finally slide down , Find the version you want
 Insert picture description here
Click in , Download a version that matches your computer
 Insert picture description here
Last , With Run the command line window in administrator mode , then Activate python37 A virtual environment , Finally, execute the following command .

pip install +tensorflow Path of file storage 

As shown below :
 Insert picture description here
There's basically no problem .

4、 test tensorflow

Test code

import tensorflow as tf 
sess = tf.Session() 
a = tf.constant(1) 
b = tf.constant(2) 
print(sess.run(a+b)) 

The operation results are as follows
 Insert picture description here
Results the correct , It's finally a success !!!!

3、 ... and 、 reference

I refer to many bloggers , I also encountered many problems in the process of downloading , In the end, it worked ( Lacrimal )
Here are the articles of bloggers I think are very good .
1、python And anaconda install ( Install the first python After the installation anaconda, be based on python Install based on existing anaconda)—— Obsessive compulsive disorder 、 Super detailed explanation
2、Anaconda+pycharm+tensorflow Installation and environment configuration (win10)
3、 The most complete and detailed in history Anaconda Installation tutorial
4、Anaconda install tensorflow High version to low version ( It's useful )

Last , If there are questions , You can ask at any time , I hope to work with you , Not to lose time , Let's meet at the top of the mountain .

原网站

版权声明
本文为[Xiongkairui]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020514191584.html