TensorFlow only supports Linux, so you do not need to consider it. Either a dual system or a virtual machine. Here I installed it in a notebook for employment, so I can only use a virtual machine. In fact, it is best to use a dual-system, so that you can use the power of the video card, provided that you have a megada video card.
Step 1: Go to the Anaconda official website to download the installation package, find the Linux 64-bit Python2.7 installation package, and download the package to your local device.
Step 2: Use WinScp to upload the file to the CentOS virtual machine. The preparation is complete.
I am used to uploading data to the root directory, so I can directly repeat the command line. If you want to put it in another directory, you need to set the path first.
The command is as follows:
[Plain] view plain copy
- <Spanstyle = "font-size: 14px;"> bashAnaconda2-4.0.0-Linux-x86_64.sh </span>
By default, the installation is good. It is best to test the command after installation: conda -- v. if the version information is displayed, the installation is successful.
I tried it several times but failed. I was prompted to run conda: command not found. At first, I thought the installation version was incorrect. I checked that the directory was correctly installed, it is best to find that the system path is not successfully configured, so you have to manually add it. The command is as follows:
export PATH=~/anaconda/bin:$PATH
Test again. The version information is successfully output.
Step 3: Create a Conda virtual environment to run TensorFlow. The command is as follows,
[Plain] view plaincopy
- <Spanstyle = "font-size: 14px;"> # Python2.7
- $ Condacreate-ntensorflowpython= 2.7 </span>
In this case, Conda will install some necessary packages. After installation, a virtual space named tensorflow is created.
Next, activate the space. The command is as follows,
[Plain] view plaincopy
- <Spanstyle = "font-size: 14px;"> $ sourceactivatetensorflow </span>
The space name is displayed before the command prompt.
Step 4: Install TensorFlow in this space. The command is as follows,
[Plain] view plaincopy
- <Spanstyle = "font-size: 14px;"> $ pipinstall -- ignore-installed -- upgradehttps: // upgrade </span>
After a long wait, the installation is complete! I have to talk about the company's network speed
The last step is test!
[Plain] view plaincopy
- $ Python
- ...
- >>> Importtensorflowastf
- >>> Hello = tf. constant ('hello, TensorFlow! ')
- >>> Sess = tf. Session ()
- >>> Print (sess. run (hello ))
- Hello, TensorFlow!
The output is successful! You can enjoy learning AI!
Exit the virtual environment after testing.
[Plain] view plaincopy
- (Tensorflow) $ deactivate