下载tensorflow

参考文章:

https://www.cnblogs.com/20183544-wangzhengshuai/p/13956698.html

https://tensorflow.juejin.im/install/install_windows.html

1、先查询下tensorflow支持python哪个版本,再查询anaconda对应版本。

  查看tenorflow对python版本的要求 :https://blog.csdn.net/qq_46941656/article/details/119775758

  tensorflow历史版本:https://pypi.org/project/tensorflow/#history

  查找anaconda对应版本:https://docs.anaconda.com/anaconda/packages/oldpkglists/

  anaconda历史版本:https://repo.anaconda.com/archive/

2、后续安装步骤:https://www.cnblogs.com/20183544-wangzhengshuai/p/13956698.html

(防止删除)

1)打开安装好的Anaconda中的 Anaconda Prompt

2)然后输入:conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/     

      conda config --set show_channel_urls yes

         这两行代码用来改成连接清华镜像的。

3)打开C:\Users\Administrator\.condarc文件:

      删除- defaults

4)然后在Anaconda Prompt中输入:conda create -n tensorflow python=3.5(python版本自己定)

5)输入activate tensorflow,切换了,就代表安装成功了。

6)安装的是CPU版本,那么在命令下紧接着输入:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

 

报错

1)cannot import name ‘OrderedDict‘ from ‘typing‘

把function_type.py

# from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, OrderedDict

改成

from typing import Any,Callable,Dict, Mapping, Optional, Sequence, Tuple

from typing_extensions import OrderedDict

 

2)The Session graph is empty. Add operations to the graph before calling run().

import tensorflow as tf
tf.compat.v1.disable_eager_execution() #保证sess.run()能够正常运行
hello = tf.constant('hello,tensorflow')
sess= tf.compat.v1.Session()#版本2.0的函数
print(sess.run(hello))

 

3)module 'tensorflow' has no attribute 'Session'

import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()

posted on   吴XX  阅读(69)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示