打开 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
来源: http://www.bubuko.com/infodetail-2988690.html