Windows环境下TensorFlow的安装及如何在Jupyter Notebook中使用TensorFlow

最近开始学习TensorFlow,因为自己电脑配置不高,只能在Windows下安装cpu版的TensorFlow。首先安装了最新版的Anaconda,接着使用pip命令安装TensorFlow出现下面的问题:

tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

原因是Windows下TensorFlow目前只支持python3.5,而最新版Anaconda带有的是python3.6。通过上网搜索获得以下解决方法:

1、首先打开cmd,通过Anaconda创建一个名为tensorflow的python3.5环境

conda create -n tensorflow python=3.5

2、启动tensorflow环境

activate tensorflow

3、安装cpu版TensorFlow,最新版可以通过GitHub下载:TensorFlow GitHub

pip install tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl

4、进入python,尝试第一个TensorFlow程序

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a+b)
42

接下来是如何在Jupyter中使用TensorFlow:

1、进入tensorFlow环境,安装ipython和jupyter

activate tensorflow
conda install ipython
conda install jupyter

2、运行命令

ipython kernelspec install-self --user

3、进如Jupyter

jupyter notebook
import tensorflow as tf

成功运行!

  • 4
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值