版权声明:勤学 修德 明辨 笃实 - CSDN周雄伟					https://blog.csdn.net/ebzxw/article/details/80701613				</div>
<link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-f1a9c33fcd.css">
<div class="htmledit_views" id="content_views">
<p>已有环境:python3.7.1<br></p><p>anaconda隔离管理多个环境,互不影响。这里,在anaconda中安装最新的python3.6.5 版本。</p><p>linux环境下使用anaconda安装tensorflow步骤见:<a href="https://blog.csdn.net/ebzxw/article/details/80693152" rel="nofollow" target="_blank">https://blog.csdn.net/ebzxw/article/details/80693152</a></p><p><strong>一. 安装anaconda</strong></p><p>1. 下载地址:&nbsp;<a href="https://www.anaconda.com/download/#windows" rel="nofollow" target="_blank">https://www.anaconda.com/download/#windows</a></p><p><img src="https://img-blog.csdn.net/20180615101323644?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p>2.&nbsp; 执行下载文件&nbsp;&nbsp;Anaconda3-5.2.0-<a href="https://www.baidu.com/s?wd=Windows&amp;tn=24004469_oem_dg&amp;rsv_dl=gh_pl_sl_csd" target="_blank">Windows</a>-x86_64.exe, 默认配置安装。</p><p><span style="background-color:rgb(255,255,255);">3.&nbsp; 检查安装结果。进入到windows中的命令模式:</span></p><p style="background-color:rgb(255,255,255);">(1)检测anaconda环境是否安装成功:conda --version</p><p style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615193442552?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p style="background-color:rgb(255,255,255);">(2)检测目前安装了哪些环境变量:conda info --envs</p><p style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615193459890?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p style="background-color:rgb(255,255,255);">(3) 查看当前有哪些可以使用的tensorflow版本:<strong>conda search&nbsp; --full -name tensorflow</strong></p><p><img src="https://img-blog.csdn.net/20180615193553707?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p><p><span style="background-color:rgb(255,255,255);">(4) 查看tensorflow包信息及依赖关系:<strong>conda&nbsp; info&nbsp; tensorflow</strong></span><br></p><p><span style="background-color:rgb(255,255,255);"><strong><img src="https://img-blog.csdn.net/2018061521501133?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></strong></span></p><p><span style="font-weight:bold;">二. 在anaconda中安装tensorflow</span></p><p><span style="background-color:rgb(255,255,255);">1.&nbsp; 进入windows命令模式,创建tfenv环境,安装python3.6:&nbsp;</span><span style="background-color:rgb(255,255,255);"><strong>conda create --name tfenv python=3.6</strong></span></p><div><img src="https://img-blog.csdn.net/20180615220036678?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></div><p><span style="background-color:rgb(255,255,255);">2 .&nbsp;<span style="background-color:rgb(255,255,255);">激活tensflow的tfenv环境: activate&nbsp; tfenv</span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615220551804?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">&nbsp; &nbsp; 检测tfenv的环境添加到了Anaconda里面:conda info --envs</span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/2018061522080997?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">看到,已经创建成功。</span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">检测当前环境中的python的版本:python --version</span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615221846949?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">退出tfenv的环境:deactivate</span><br></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615222102462?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">3.&nbsp; 在tfenv环境<a href="https://www.baidu.com/s?wd=%E4%B8%AD%E6%AD%A3%E5%BC%8F&amp;tn=24004469_oem_dg&amp;rsv_dl=gh_pl_sl_csd" target="_blank">中正式</a>安装tensorflow包</span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">1)<span style="background-color:rgb(255,255,255);">激活tensflow的tfenv环境: activate&nbsp; tfenv</span></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">2)pip install --upgrade --ignore-installed tensorflow</span></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615222656314?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615224852188?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">3) 验证功能正常:python 进入代码环境</span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615225105865?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></span></p><pre onclick="hljs.copyCode(event)"><code class="language-python hljs"><ol class="hljs-ln"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">hello = tf.constant(<span class="hljs-string">'hello,tf'</span>)</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">sess = tf.Session()</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">print(sess.run(hello))</div></div></li></ol></code><div class="hljs-button" data-title="复制"></div></pre><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><img src="https://img-blog.csdn.net/20180615225701383?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);">可以看到, 该环境下 tensorflow 工作正常。</span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="font-weight:700;">三.&nbsp; 安装可能的异常</span><br></span></span></span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"></span></span></span></span></p><p style="background-color:rgb(255,255,255);"><span><span style="color:rgb(255,0,0);">温馨提示:如果你的conda和tensorflow环境都是安装成功的,但是一用测试代码进行跑的时候就出问题了,那么注意,这个原因你由于你在安装tensorflow的时候,是直接在cmd下,而不是在你用conda激活的一个环境,所以导致,tensorflow并没有直接嵌入到conda环境,所以,就导致无法导入模块的一个错误;</span></span></p><p style="background-color:rgb(255,255,255);"><span><span style="color:rgb(255,0,0);">解决方法:(1)只需要在activate&nbsp; tfenv</span></span></p><p style="background-color:rgb(255,255,255);"><span><span style="color:rgb(255,0,0);">(2)然后再使用&nbsp;<span style="background-color:rgb(255,255,255);">pip install --upgrade --ignore-installed tensorflow&nbsp;</span>命令安装就可以了</span></span></p><p><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="background-color:rgb(255,255,255);"><span style="font-weight:700;background-color:rgb(255,255,255);">四.&nbsp; 将tensorflow嵌入到IDE中</span></span></span></span></span></p><p>这里的关键是配置后,IDE使用的python环境包含tensorflow就可以。</p><p>1. windows操作命令下设置默认python环境</p><p>可通过环境变量的顺序来设置。(这里是之前就有的python3.6.1环境和在anaconda中装的python3.6.5)</p><p><img src="https://img-blog.csdn.net/20180616100818536?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p>“系统属性”页面,点击“环境变量”&nbsp; ,选中PATH,点“编辑”</p><p><img src="https://img-blog.csdn.net/20180616100952319?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p>选中希望优先执行的python版本路径,“上移”到顶。 这里是把anaconda安装后默认在最上面,改为原来的3.6.1版本了。</p><p><img src="https://img-blog.csdn.net/20180616101110912?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p><strong>结果验证与环境切换:</strong></p><p><img src="https://img-blog.csdn.net/20180616101310565?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p><img src="https://img-blog.csdn.net/20180616101403452?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p>2.&nbsp; VSCODE里设置默认python环境 (演示设置为原来python3.6.1)<br></p><p>打开编辑器。 文件 - 首选项 - 设置</p><p>找到“用户工作区设置”,更改 python.pythonPath 配置变量即可。</p><p></p><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas, 'Courier New', monospace;font-size:14px;line-height:19px;white-space:pre;"><div> <span style="color:#9cdcfe;">"python.pythonPath"</span>: <span style="color:#ce9178;">"C:</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">Users</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">user</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">AppData</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">Local</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">Programs</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">python</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">Python36</span><span style="color:#d7ba7d;">\\</span><span style="color:#ce9178;">python.exe"</span></div><div><span style="color:#608b4e;">// "python.pythonPath": "C:\\Users\\user\\Anaconda3\\python.exe" </span></div><div></div></div>界面如下图:<p><img src="https://img-blog.csdn.net/20180616101653664?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Vienh3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""><br></p><p>重启vscode即可。</p> </div>
</div>
posted @
2019-01-27 13:34 
兰翔 
阅读(...) 
评论(...) 
编辑 
收藏

使用anaconda安装tensorflow (windows10环境)的更多相关文章

  1. 基于Anaconda安装Tensorflow 并实现在Spyder中的应用

    基于Anaconda安装Tensorflow 并实现在Spyder中的应用 Anaconda可隔离管理多个环境,互不影响.这里,在anaconda中安装最新的python3.6.5 版本. 一.安装 ...

  2. win10+anaconda安装tensorflow和keras遇到的坑小结

    win10下利用anaconda安装tensorflow和keras的教程都大同小异(针对CPU版本,我的gpu是1050TI的MAX-Q,不知为啥一直没安装成功),下面简单说下步骤. 一 Anaco ...

  3. 【tensorflow】1.安装Tensorflow开发环境,安装Python 的IDE--PyCharm

    ================================================== 安装Tensorflow开发环境,安装Python 的IDE--PyCharm 1.PyCharm ...

  4. 我在Suse 11 Sp3上使用anaconda安装TensorFlow的过程记录

    我在Suse 11 Sp3上使用anaconda安装TensorFlow的过程记录 准备安装包: gcc48 glibc--SP4-DVD-x86_64-GM-DVD1.iso tensorflow_ ...

  5. Ubuntu环境下Anaconda安装TensorFlow并配置Jupyter远程访问

    本文主要讲解在Ubuntu系统中,如何在Anaconda下安装TensorFlow以及配置Jupyter Notebook远程访问的过程. 在官方文档中提到,TensorFlow的安装主要有以下五种形 ...

  6. Windows环境下Anaconda安装TensorFlow的避坑指南

    最近群里聊天时经常会提到DL的东西,也有群友在学习mxnet,但听说坑比较多.为了赶上潮流顺便避坑,我果断选择了TensorFlow,然而谁知一上来就掉坑里了…… 我根据网上的安装教程,默认安装了最新 ...

  7. Windows10下通过anaconda安装tensorflow

    博主经历了很多的坎坷磨难才找到一个比较好的在win10下安装TensorFlow的方法: 首先需要说明的是如果你想通过Anaconda来安装tensorflow的话,首先要确认你的python的版本是 ...

  8. windows 下 Anaconda 安装 TensorFlow

    转自: https://www.cnblogs.com/nosqlcoco/p/6923861.html 什么是 Anaconda? Anaconda is the leading open data ...

  9. win7 使用anaconda安装tensorflow并且在jupyter notebook上启动

    记录一下学习深度学习的小事情: 1.tensorflow 现在只支持windows 64位系统: 2.因为实验室的电脑比较老旧,Gpu配置低,所以选择安装的是tensorflow Cpu版本,对于学习 ...

随机推荐

  1. 关于Conversion to Dalvik format failed with error 1错误

    在用Android导入一个新项目时,不知道为啥就碰上这个错误.在网上搜了半天,发现各种办法都有,但是最后居然是:将一个项目下的文件夹libs作为了source folder,而又在Proporties ...

  2. Ubuntu下录制屏幕并转换成gif【转】

    本文转载自:https://blog.csdn.net/u012964944/article/details/50464263 *录制屏幕 1)打开Ubuntu软件中心,安装RecordMyDeskt ...

  3. SprigBoot核心技术

    启动原理 运行流程 自动配置原理 一.启动原理 SpringApplication.run(主程序类)– new SpringApplication(主程序类)• 判断是否web应用• 加载并保存所有 ...

  4. 前端工程化 - gulp

    gulp是什么 gulp就是一个前端的自动化构建工具,在开发过程中很多重复的任务可以使用gulp和gulp插件自动完成.相比于grunt,gulp非常好上手,核心API只有4个,而且还有丰富的插件库. ...

  5. 如何以Root权限在Pycharm上Run、Debug

    Pycharm官网提问:https://intellij-support.jetbrains.com/hc/en-us/community/posts/206587695-How-to-run-deb ...

  6. phpstorm 2017版代码提示功能开启解决方案

    安装好phpstorm 2017之后 发现代码高亮和函数自动提示都失效了 在phpstorm底部面板的信息提示处发现有一条系统消息: 12:04:18 Power save mode is on Co ...

  7. Intel IDEA 2018破解(亲测成功)

    破解网址:https://jingyan.baidu.com/article/cb5d6105d9b1b1005d2fe074.html

  8. poj3814

    题解: 所以poj只放了一组数据? 打表(花费了我无数心血找的的打标) 代码: #include <stdio.h> int main(){ printf("1\n2\n1\n2 ...

  9. 彻底弄懂jQuery事件原理二

    上一篇说到,我们在最外层API的on,off,tiggler,triggerHandler调用的是event方法的add,remove和tirgger方法,本篇就来介绍event辅助类 \ 先放个图, ...

  10. PostgreSQL脱敏示例

    mydb=# create table test_desensitization(id integer, name varchar(32), phone_num varchar(11)); CREAT ...