版权声明:勤学 修德 明辨 笃实 - 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. Net Quartz使用

    安装Quartz 已经先安装了2.5版本,现在换成2.4 程序包管理器控制台: PM> Install-Package Quartz -Version 2.4 正在尝试收集与目标为“.NETFr ...

  2. SharePoint研究之表单登录配置

    本文将演示SharePoint怎样配置表单(Form)登录,后续文章将研究 无密码登录.编程添加用户组.编程添加用户.编程添加文件夹.编程分享文件夹(权限分配)等. 知识点:SharePoint.Sq ...

  3. Python学习札记(三十二) 面向对象编程 Object Oriented Program 3

    参考:访问限制 NOTE 1.eg. #!/usr/bin/env python3 class Student(object): """docstring for Stu ...

  4. OpenDayLight Helium安装

    参照:OpenDaylight的Helium(氦)版本安装 下载链接地址为 http://www.opendaylight.org/software/downloads/helium 安装: unzi ...

  5. postman 安装桌面版

    https://github.com/postmanlabs/postman-app-support

  6. Java实现时钟小程序【代码】

    哎,好久没上博客园发东西了,上一次还是两个月前的五一写的一篇计算器博客,不过意外的是那个程序成了这学期的Java大作业,所以后来稍微改了一下那个程序就交了上去,这还是美滋滋.然后五月中旬的时候写了一个 ...

  7. hdu4292网络流dinic

    因为数组开小了,导致tle了一整天:( tle的几点原因:http://blog.csdn.net/ameir_yang/article/details/53698478 思路都是对的,把每个人进行拆 ...

  8. 浅析使用vue-router实现前端路由的两种方式

    关于vue-router 由于最近的项目中一直在使用vue,所以前端路由方案也是使用的官方路由vue-router,之前在angularJS项目中也是用过UI-router,感觉大同小异,不过很显然v ...

  9. rabbitmq 对多服务器p2p模式配置的一个测试

    一直对rabbitmq p2p 模式的多服务器下做相同配置的 各个服务器数据接受情况比较好奇 今天有空测试了下 xml 文件 <?xml version="1.0" enco ...

  10. keras_基本网络层结构(2)_卷积层

    参考文献:http://keras-cn.readthedocs.io/en/latest/layers/convolutional_layer/ 卷积层 Conv1D层 keras.layers.c ...