学习笔记(六)ubuntu16.04下Sublime Text3配置anaconda和tensorflow
参考博客:http://blog.csdn.net/zhaoyu106/article/details/52858962
http://blog.csdn.net/u011974639/article/details/72851153 的step5部分
注:本文非标准教程,仅是总结个人学习过程,可能存在纰漏,如有错误之处欢迎留言告知,非常感谢
上一篇学习笔记是使用IPYTHON去编译tensorflow,但是我没有图形化界面实在不习惯,于是下了很多
IDE尝试去编译tensorflow,但是一律都是报错ImportError: No module named ‘tensorflow’,查了很多资料一点一点试终于不报错了QAQ
下面我记录一下我的步骤,有疏漏、错误之处欢迎留言补充。
1.
从万千IDE中我选了ST3,为什么呢!因为好看!来欣赏一下它的颜值
使用VScode、pycharm、spyder或者别的IDE也是可以的。
2.
使用ST3必须先安装package control,安装方法在学习笔记(四)中详细介绍了,这篇就不再赘述。
在安装了package control后,快捷键Ctrl+shift+P进入package control,输入install,点击Package Control:Install Package,回车,搜索anaconda,安装第一个选项。
等一会安装好之后,Preferences→package settings就可以看到anaconda。
网上说要在anaconda后的settings-Default和Settings-User上配置python地址,参考http://blog.csdn.net/zhaoyu106/article/details/52858962里的“配置”部分,但这好像和我编译tensorflow代码暂时没什么用处,也许以后会用到,我先记在这里。
3.
接下来要做能主要影响到解决识别不到tensorflow模块这个问题的步骤:
Ctrl+shift+P调出package control,输入res,找到PackageResourceViewer,点击安装。
过了一会安装好了之后再次Ctrl+shift+P,输入 resource,选择PackageResourceViewer:Open Resource,再选择Python,再再选择Python.sublime-build。
然后打开的界面是这样的:
第一行shell_cmd后面就是python解释器的地址,在默认地址下我能够编译opencv但不能编译tensorflow。现在需要将“python”替换成我们包括tensorflow模块的python解释器地址。
这个地址是什么呢!还记得configure tensorflow的时候填的这个python地址吗?
就是下面这个熟悉的步骤:
1.Please specify the location of python. [Default is /home/xutian/anaconda3/bin/python]: /home/xutian/anaconda3/bin/python3.5
2.Please input the desired Python library path to use. Default is [/home/xutian/anaconda3/lib/python3.5/site-packages]:默认
3.Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]:y
4.Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: n
5.Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: n
6.Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: n
7.Do you wish to build TensorFlow with XLA JIT support? [y/N]: n
8.Do you wish to build TensorFlow with GDR support? [y/N]: n
9.Do you wish to build TensorFlow with VERBS support? [y/N]: n
10.Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
11.Do you wish to build TensorFlow with CUDA support? [y/N]: y
12.Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 9.0]: 9.1
13.ease specify the location where CUDA 9.1 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-9.1
14.Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7.0]: 7.0.5
15.Please specify the location where cuDNN 7.0 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-9.1]:/usr/local/cuda-9.1
16.Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 5.0]5.0
17.Do you want to use clang as CUDA compiler? [y/N]: n
18.Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 默认
19.Do you wish to build TensorFlow with MPI support? [y/N]: n
20.Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 默认
21.Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Configuration finished
就是第一个问题那里那个地址,注意有的人填的是python有的人是python3.5。
用这个地址替换掉“python”的位子。
修改后如下图。
然后我就可以编译tensorflow了,很开心的看到finished
大概就是这样,欢迎补充。~
上一篇: 第八十九课.Object-2