tensorflow安装(anaconda、tensorflow2)

tensorflow安装(anaconda、tensorflow2),第1张

tensorflow安装(anaconda、tensorflow2)

tensorflow安装(anaconda、tensorflow2)
anaconda prompt里面
先是参考了这篇
https://blog.51cto.com/u_15080029/2642930
执行conda create --name tf2.0 python=3.7建立一个名为tf2.0的虚拟环境。(一开始打算安装2.0版本,中途改了,但是创建的虚拟环境懒得改名)
建立成功进入tf2.0环境:conda activate tf2.0
安装tensorflow2.0 : pip install tensorflow==2.0.0-beta1
但是这里失败了,改为安装tensorflow2.1.0
参考这篇https://blog.csdn.net/qq_38316655/article/details/105435246
在tf2.0虚拟环境中:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U tensorflow

测试:先在tf2.0环境下装个jupyter
在tf2.0环境安装,pip3 install jupyter notebook
安装成功后执行jupyter notebook
浏览器会打开jupyter界面,新建一个python3文件,输入以下内容:
import tensorflow as tf

A=tf.constant([[1,2],[3,4]])
B=tf.constant([[5,6],[7,8]])
C=tf.matmul(A,B)
print©
显示:tf.Tensor(
[[19 22]
[43 50]], shape=(2, 2), dtype=int32)
成功

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5651839.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存