tensorflow安装

dq0618 / 2023-08-04 / 原文

TensorFlow下载和安装详解(两种常用方式) | 艾奇编程网 (91yiqixue.com)

 pip install tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

碰到错误信息解决错误信息(大概3-4个错误信息)

错误信息
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
解决方式
直接忽略旧版本进行升级:
pip install six --upgrade --ignore-installed six

 

 

 

验证是否安装成功:

conda list

 

或在pycharm中的python文件输入如下程序:

import tensorflow as tf

tf.compat.v1.disable_eager_execution()

hello = tf.constant('ggg!')

sess = tf.compat.v1.Session()

print(sess.run(hello))

观察结果是否能够打印

如果想将tensorflow升级 则重新安装下 运行下面代码 将2.0.0更改为想装的版本

 pip install tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple