官术网_书友最值得收藏!

Installing TensorFlow

  1. Execute the following command to install tensorflow using conda:
conda install -c conda-forge tensorflow 

The output of this command will fetch metadata and install a list of packages, as follows:

Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment /home/ubuntu/miniconda2:
  1. The following new packages will also be installed:
bleach: 1.5.0-py27_0 conda-forge
funcsigs: 1.0.2-py_2 conda-forge
futures: 3.2.0-py27_0 conda-forge
html5lib: 0.9999999-py27_0 conda-forge
markdown: 2.6.9-py27_0 conda-forge
mock: 2.0.0-py27_0 conda-forge
pbr: 3.1.1-py27_0 conda-forge
protobuf: 3.5.0-py27_0 conda-forge
tensorboard: 0.4.0rc3-py27_0 conda-forge
tensorflow: 1.4.0-py27_0 conda-forge
webencodings: 0.5-py27_0 conda-forge
werkzeug: 0.12.2-py_1 conda-forge
  1. A higher-priority channel will supersede the following packages, as follows:
conda: 4.3.30-py27h6ae6dc7_0 --> 4.3.29-py27_0 conda-forge
conda-env: 2.6.0-h36134e3_1 --> 2.6.0-0 conda-forge
Proceed ([y]/n)? y
conda-env-2.6. 100% |#############################################################| Time: 0:00:00 1.67 MB/s
...
mock-2.0.0-py2 100% |#############################################################| Time: 0:00:00 26.00 MB/s
conda-4.3.29-p 100% |#############################################################| Time: 0:00:00 27.46 MB/s
  1. Once TensorFlow has been installed, let's test it with a simple program. Create a new file called hello_tf.py with the following command:
vi hello_tf.py
  1. Add the following code to this file and save the file:
import tensorflow as tf
hello = tf.constant('Greetings, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
  1. Execute the file created from the command line:
python hello_tf.py

The output will make sure the library has been successfully installed:

Greetings, TensorFlow!
主站蜘蛛池模板: 临邑县| 亚东县| 芜湖县| 皋兰县| 滦平县| 乌拉特中旗| 乐昌市| 金坛市| 汽车| 阿鲁科尔沁旗| 普兰店市| 巴楚县| 陇西县| 洪雅县| 庆云县| 丰原市| 郁南县| 建宁县| 额敏县| 太白县| 瑞金市| 广西| 股票| 龙口市| 屏东市| 开封市| 廊坊市| 巢湖市| 马关县| 沂源县| 渝北区| 邯郸县| 绩溪县| 永善县| 沙河市| 延川县| 绥江县| 阿瓦提县| 城固县| 勐海县| 壤塘县|