安装tensorflow

来源:互联网 发布:维普期刊数据库 编辑:程序博客网 时间:2024/06/16 13:31

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

安装完anaconda之后就好办了。

如下步骤:

zz@T630:~$ conda create -n tensorflow python=3.6Fetching 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)? yca-certificate 100% |#############################################################################################################################| Time: 0:00:00   1.47 MB/sncurses-5.9-10 100% |#############################################################################################################################| Time: 0:00:00   5.67 MB/ssqlite-3.13.0- 100% |#############################################################################################################################| Time: 0:00:00   9.26 MB/stk-8.5.19-2.ta 100% |#############################################################################################################################| Time: 0:00:00   8.25 MB/sxz-5.2.3-0.tar 100% |#############################################################################################################################| Time: 0:00:00   8.20 MB/szlib-1.2.11-0. 100% |#############################################################################################################################| Time: 0:00:00  13.79 MB/sopenssl-1.0.2l 100% |#############################################################################################################################| Time: 0:00:00   8.89 MB/sreadline-6.2-0 100% |#############################################################################################################################| Time: 0:00:00   7.81 MB/spython-3.6.2-0 100% |#############################################################################################################################| Time: 0:00:03   6.56 MB/scertifi-2017.7 100% |#############################################################################################################################| Time: 0:00:00   6.25 MB/ssetuptools-36. 100% |#############################################################################################################################| Time: 0:00:00   6.15 MB/swheel-0.29.0-p 100% |#############################################################################################################################| Time: 0:00:00  12.04 MB/spip-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 tensorflowCollecting 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.whlRequirement 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.whlCollecting 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/c93e17ae86ae3b3a919c7b39dad3b5ccf09aeb066419e5c1e5Successfully built html5lib markdownInstalling collected packages: numpy, six, protobuf, html5lib, markdown, bleach, werkzeug, tensorflow-tensorboard, tensorflowSuccessfully 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:~$ pythonPython 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 linuxType "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装好了,但是有些警告说有些命令在目前的机器上无法使用,不过没关系,这个问题我在另一个帖子中有记录传送门。这次本着能用就用的消极心理就先不折腾了,的用且用吧,过几天有时间再重新编译,主要是我没有权限。

原创粉丝点击