All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term


Install TensorFlow

Last updated:2020-12-10 11:21:34

Install TensorFlow

Online installation

Verify that the network connection is operating properly and execute the following command:

pip3 install --upgrade tensorflow-gpu

Install TensorFlow by using the source code

  1. Access TensorFlow 1.5.0 or copy the link to the web browser address bar.
  2. Download the proper GPU version. In this example, the version for Python 3.5 is downloaded. The downloaded file is tf_nightly_gpu-1.head-cp35-cp35m-linux_x86_64.whl.


  3. Execute the following command to install TensorFlow:

    pip3 install tf_nightly_gpu-1.head-cp35-cp35m-linux_x86_64.whl

Verify the installation

After you install TensorFlow, execute a Python script file that contains the following code to verify the installation:

import tensorflow as tf
import numpy as np
x_data = np.float32(np.random.rand(2, 100))
y_data =[0.100, 0.200], x_data) + 0.300
b = tf.Variable(tf.zeros([1]))
W = tf.Variable(tf.random_uniform([1, 2], -1.0, 1.0))
y = tf.matmul(W, x_data) + b
loss = tf.reduce_mean(tf.square(y - y_data))
optimizer = tf.train.GradientDescentOptimizer(0.5)
train = optimizer.minimize(loss)
init = tf.initialize_all_variables()
sess = tf.Session()
for step in range(0, 201):
    if step % 20 == 0:
        print (step,,*

If TensorFlow has been installed successfully, the following information is displayed: 验证环境.jpg

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen