安装tensorflow

前面有介绍安装anaconda的日志,可以参考一下 传送门

安装完anaconda之后就好办了。

如下步骤:

zz@T630:~$ conda create -n tensorflow python=3.6
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /home/zz/anaconda3/envs/tensorflow:

The following NEW packages will be INSTALLED:

    ca-certificates: 2017.7.27.1-0     
    certifi:         2017.7.27.1-py36_0
    ncurses:         5.9-10            
    openssl:         1.0.2l-0          
    pip:             9.0.1-py36_0      
    python:          3.6.2-0           
    readline:        6.2-0             
    setuptools:      36.2.2-py36_0     
    sqlite:          3.13.0-1          
    tk:              8.5.19-2          
    wheel:           0.29.0-py36_0     
    xz:              5.2.3-0           
    zlib:            1.2.11-0          

Proceed ([y]/n)? y

ca-certificate 100% |#############################################################################################################################| Time: 0:00:00   1.47 MB/s
ncurses-5.9-10 100% |#############################################################################################################################| Time: 0:00:00   5.67 MB/s
sqlite-3.13.0- 100% |#############################################################################################################################| Time: 0:00:00   9.26 MB/s
tk-8.5.19-2.ta 100% |#############################################################################################################################| Time: 0:00:00   8.25 MB/s
xz-5.2.3-0.tar 100% |#############################################################################################################################| Time: 0:00:00   8.20 MB/s
zlib-1.2.11-0. 100% |#############################################################################################################################| Time: 0:00:00  13.79 MB/s
openssl-1.0.2l 100% |#############################################################################################################################| Time: 0:00:00   8.89 MB/s
readline-6.2-0 100% |#############################################################################################################################| Time: 0:00:00   7.81 MB/s
python-3.6.2-0 100% |#############################################################################################################################| Time: 0:00:03   6.56 MB/s
certifi-2017.7 100% |#############################################################################################################################| Time: 0:00:00   6.25 MB/s
setuptools-36. 100% |#############################################################################################################################| Time: 0:00:00   6.15 MB/s
wheel-0.29.0-p 100% |#############################################################################################################################| Time: 0:00:00  12.04 MB/s
pip-9.0.1-py36 100% |#############################################################################################################################| Time: 0:00:00   5.42 MB/s
#
# To activate this environment, use:
# > source activate tensorflow
#
# To deactivate an active environment, use:
# > source deactivate
#
zz@T630:~$ source activate tensorflow
(tensorflow) zz@T630:~$
(tensorflow) zz@T630:~$ pip install tensorflow
Collecting tensorflow
  Downloading tensorflow-1.3.0-cp36-cp36m-manylinux1_x86_64.whl (43.5MB)
    100% |████████████████████████████████| 43.6MB 15kB/s 
Collecting numpy>=1.11.0 (from tensorflow)
  Downloading numpy-1.13.1-cp36-cp36m-manylinux1_x86_64.whl (17.0MB)
    100% |████████████████████████████████| 17.0MB 39kB/s 
Collecting six>=1.10.0 (from tensorflow)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: wheel>=0.26 in ./anaconda3/envs/tensorflow/lib/python3.6/site-packages (from tensorflow)
Collecting protobuf>=3.3.0 (from tensorflow)
  Downloading protobuf-3.4.0-cp36-cp36m-manylinux1_x86_64.whl (6.2MB)
    100% |████████████████████████████████| 6.2MB 104kB/s 
Collecting tensorflow-tensorboard<0.2.0,>=0.1.0 (from tensorflow)
  Downloading tensorflow_tensorboard-0.1.5-py3-none-any.whl (2.2MB)
    100% |████████████████████████████████| 2.2MB 282kB/s 
Requirement already satisfied: setuptools in ./anaconda3/envs/tensorflow/lib/python3.6/site-packages (from protobuf>=3.3.0->tensorflow)
Collecting html5lib==0.9999999 (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
  Downloading html5lib-0.9999999.tar.gz (889kB)
    100% |████████████████████████████████| 890kB 558kB/s 
Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
  Downloading Markdown-2.6.9.tar.gz (271kB)
    100% |████████████████████████████████| 276kB 1.1MB/s 
Collecting bleach==1.5.0 (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
  Downloading bleach-1.5.0-py2.py3-none-any.whl
Collecting werkzeug>=0.11.10 (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
  Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
    100% |████████████████████████████████| 317kB 973kB/s 
Building wheels for collected packages: html5lib, markdown
  Running setup.py bdist_wheel for html5lib ... done
  Stored in directory: /home/zz/.cache/pip/wheels/6f/85/6c/56b8e1292c6214c4eb73b9dda50f53e8e977bf65989373c962
  Running setup.py bdist_wheel for markdown ... done
  Stored in directory: /home/zz/.cache/pip/wheels/bf/46/10/c93e17ae86ae3b3a919c7b39dad3b5ccf09aeb066419e5c1e5
Successfully built html5lib markdown
Installing collected packages: numpy, six, protobuf, html5lib, markdown, bleach, werkzeug, tensorflow-tensorboard, tensorflow
Successfully installed bleach-1.5.0 html5lib-0.9999999 markdown-2.6.9 numpy-1.13.1 protobuf-3.4.0 six-1.10.0 tensorflow-1.3.0 tensorflow-tensorboard-0.1.5 werkzeug-0.12.2
(tensorflow) zz@T630:~$ 

然后怀着激动的心情赶紧试了一下:

(tensorflow) zz@T630:~$ python
Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 22:59:30) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello,TensorFlow!')
>>> sess = tf.Session()
2017-09-02 10:14:47.114621: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-02 10:14:47.114656: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-02 10:14:47.114668: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-09-02 10:14:47.114678: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-02 10:14:47.114687: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
>>> print(sess.run(hello))
b'Hello,TensorFlow!'
>>> 

说明一下:上面的代码是可以成功运行的,import tensorflow as tf执行之后没有告诉你其他信息就说明tensorflow装好了,但是有些警告说有些命令在目前的机器上无法使用,不过没关系,这个问题我在另一个帖子中有记录传送门。这次本着能用就用的消极心理就先不折腾了,的用且用吧,过几天有时间再重新编译,主要是我没有权限。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值