windows下通过Anaconda安装tensorflow

维基百科上对Anaconda的介绍:
Anaconda is a freemium open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system conda.
这里引出了conda的概念,再次百科一下conda:
Conda is an open source, cross-platform, language-agnostic package manager and environment management system that installs, runs, and updates packages and their dependencies.Conda allows users to easily

  • install different versions of binary software packages and any required libraries appropriate for their computing platform
  • switch between package versions
  • download and install updates from a software repository.

Conda is written in the Python programming language, but can manage projects containing code written in other languages (e.g., R), including multi-language projects. Conda can install the Python programming language, while similar Python-based cross-platform package managers (such as wheel or pip) cannot.

遇到的一个小问题:百度TensorFlow搜出的英文官网打不开,需要emmmmmm…你懂得,喜迎党的十九大,一大批VPN又GG了。另外一个可以打开的网址:
Tensorflow

根据官网步骤:
1.Follow the instructions on the Anaconda download site to download and install Anaconda.
去Anaconda官网安装,选择了Python3.6-64bit版本
2.Create a conda environment named tensorflow by invoking the following command:
C:> conda create -n tensorflow python=3.5
打开Anaconda prompt,输入上述命令
3.然后按照提示输入命令激活TensorFlow环境
activate tensorflow
4.Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow
继续在Anaconda Prompt中输入上述命令,install CPU版,暂时用不到GPU加速版

到了这步,TensorFlow已经安装完毕,接下来安装spyder编译器。
默认Anaconda已经安装了一个Spyder编译器,但是并不是TensorFlow环境下的,无法调用TensorFlow。
1.打开Anaconda Navigator
2.在主页面中选择Applications on TensorFlow,找到Spyder,Install

安装完毕,打开Spyder,输入代码验证:

import tensorflow as tf  
hello = tf.constant('Hello, TensorFlow!')  
sess = tf.Session()  
print(sess.run(hello)) 

没有报错,正确输出:b'Hello, TensorFlow!'成功!

之后可能会用到GPU加速版,再做研究。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值