赞
踩
官网下载anaconda(https://www.anaconda.com/products/distribution)
如果只用anaconda,也可以在这里下载,按照压缩包里的word文档安装即可:
链接:https://pan.baidu.com/s/1xAYeItb-8cgfsM8asCdGUw?pwd=xftx
提取码:xftx
(1)检测anaconda环境是否安装成功
conda --version
(2)检测目前安装了哪些环境变量:
conda info –-envs
(3) 在anaconda内安装一个配套的python并新建一个tensorflow的环境
conda create -n TF2 python==3.9
(TF2是自己命名的)
然后输入y
(1)使用activate TF2(与你刚刚新建的环境名称相同)命令打开刚刚新建的tensorflow环境
activate TF2
若退出tensorflow的环境:
deactivate
(2)输入命令
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
5.测试
python
import tensorflow as tf
tf.__version__
pycharm windows版本下载地址:https://www.jetbrains.com/pycharm/download/#section=windows
import tensorflow as tf
tensorflow_version = tf.__version__
gpu_avilable = tf.test.is_gpu_available()
print("tensorflow version: ", tensorflow_version,"\tGPU aviable:", gpu_avilable)
a = tf.constant([1.0,2.0], name = 'a')
b = tf.constant([1.0,2.0], name = 'b')
result = tf.add(a,b,name='add')
print(result)
结果:
若在acanoda里没安装成功tensorflow,则在pycharm里进行安装。
点击File-settings
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。