An article to solve the installation of tensorflow under Linux

Recently, I hope to use anaconda to install tensorflow in the linux environment, and I will make a record here.
The default installation environment of this article
System: linux
cuda: 10.1 (check your own cuda version command: nvcc -V)
anaconda:
pip The
above are all installed by default, please refer to the relevant tutorials.
We must first install a virtual environment, then what is it virtual environment, in my understanding, it is a virtual environment is what your new environment configured in this environment free from outside interference can not affect the outside world , this is my own understanding , Then take me as an example, use anaconda to create a new virtual environment command as

conda create -n ruitest python=3.6 anaconda

Among them, ruitest is the name of my virtual space, and python is your own version. After executing this statement, there is a step in the middle process that requires you to enter "Y" yourself, so create a new folder.
**At this step, some tutorials like to name the file name tensorflow, so some people may feel very confused, why download tensflow twice, **Then we can clearly know from here that it is actually the file name. Then after creating the virtual space and the name of the virtual space, if we forget the name, we can enter the command

conda env list

So as to be able to determine our file name.
First enter our virtual space command line

source activate ruitest

Insert picture description here
The above is the name of our space. Next, install tensorflow and
execute the command first.

pip install tensorflow-gpu==1.14.0

I downloaded gpu1.14. Of course, I can download other versions.
Of course, if the domestic download is slow, you can switch to a domestic source. For specific operation methods, you can search for tutorials. There are many tutorials listed. Replace it with a
domestic source
. How to check the current source, but according to my personal
opinion , there is a problem "no module named tensorflow" during the test.
I personally use the following method to download successfully and
solve the no module.
Actually, there are many problems, such as inputting the test statement

import tensorflow as tf

There will be a bunch of warnings later. I wanted to solve these problems at the time. In fact, sometimes these warnings are not errors and do not delay the use. This also reminds us that some problems can be ignored if the relevant package adaptation project is used.

In fact, after I used annconda and installed it, I still encountered some problems. The problem was
FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version.
Later I learned that the reason was because the numpy version was too high. , Reinstall the adapted version.
I have tried many errors in it, and also tried the offline version. I won’t repeat them here. If you leave the problem in the comment area, I will solve it with you and learn together.

Guess you like

Origin blog.csdn.net/qq_41803340/article/details/112889873