利用Anaconda搭建TensorFlow环境并在Jupyter Notebook使用

打开Anaconda Prompt


创建一个tensorflow 虚拟环境:
conda create -n tensorflow python=3.6

激活tensorflow虚拟环境
activate tensorflow

查找当前可用的tensorflow包
anaconda search -t conda tensorflow

 

 


根据提示,查看一个包的详情信息
anaconda show anaconda/tensorflow


根据提示,copy命令安装tensorflow
conda install –channel https://conda.anaconda.org/anaconda tensorflow

查看环境,确认安装是否成功
conda info –envs

也可以测试一下
python
import tensorflow as tf
hello = tf.constant("Hello tensorflow!")
session = tf.Session()
print(session.run(hello))
至此,完成了tensorTensorFlow的安装,但是要在jupyter notebook中用的话还需要下面的操作

jupyter中使用TensorFlow
在激活TensorFlow之后安装ipython和jupyter

(tensorflow)D:>conda install ipython
···
(tensorflow)D:>conda install jupyter
···
打开Jupyter notebook

试试 import tensorflow as tf

来源:CSDN
原文:https://blog.csdn.net/weixin_41043240/article/details/79519118

猜你喜欢

转载自www.cnblogs.com/USTC-ZCC/p/10539661.html