安装tensorflow(python=3.6.5)

1.创建python虚拟环境,设置python=3.6.5,命名为test

 C:\Users\luo>conda create --name test python=3.6.5

2.进入虚拟环境

activate test

3.从豆瓣源下载tensorflow,版本为1.15.0,cpu版本

pip  install  -i  https://pypi.doubanio.com/simple/  --trusted-host pypi.doubanio.com  tensorflow==1.15.0

这里有可能会出错,
比如上图出现错误,关于wrapt的错误这里暂时不知怎么解决,但是我首先

pip uninstall protobuf

卸载了protobuf之后,再次运行

pip  install  -i  https://pypi.doubanio.com/simple/  --trusted-host pypi.doubanio.com  tensorflow==1.15.0

这一次虽然也出现了报红wrapt,但最终显示似乎已经安装wrapt成功
第二次重试的最终截图
第二次之后安装tensorflow成功了

4.之后进入python,使用tensorflow,查看版本
出现上图的对应1.15.0版本

5.配置jupyter Notebook的内核
5.1首先安装ipykernel,还是使用的豆瓣源,使用默认源时出现超时错误,下载太慢了。

python -m pip  install  -i  https://pypi.doubanio.com/simple/  --trusted-host pypi.doubanio.com  ipykernel

5.2接下来添加jupyter Notebook的内核,这里name后面是命名的内核名字,这里我命名为test,与虚拟环境名字一致。

python -m ipykernel install --name test

5.3 查看jupyter Notebook的内核有哪些,使用如下命令列出内核。

jupyter kernelspec list

5.4 新建jupyter Notebook示例

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

输出如图所示:

输出上图表示安装tensorflow成功

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值