Anaconda安装Tensorflow win10 CPU
cmd
一开始我是在cmd下用pip来安装tensorflow
输入:
pip install --upgrade tensorflow
或者
pip install tensorflow
或
pip install --ignore-installed --upgrade tensorflow
都显示:Could not find a version that satisfies the requirement tensorflow
于是我自己上官网下载python3.7的对应tensorflow2.1.0版本,然后再在cmd进入目录进行pip install
网址:链接
结果还是Could not find a version
最后我用
pip3 install tensorflow==2.0.0-alpha0
下载成功了,测试没问题
Anaconda安装Tensorflow
1.为了下载更快,用了清华的镜像,在Anaconda prompt下
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
2.利用Anaconda创建一个python3.7的环境,环境名称为tensorflow:
conda create -n tensorflow python=3.7
3.在Anaconda Prompt中启动tensorflow环境:
activate tensorflow
4.安装tensorflow:
conda install tensorflow
下载成功了
5.测试TensorFlow,激动人心
在Anaconda Prompt中启动tensorflow环境,并进入python环境:
activate tensorflow
python
输入:
import tensorflow as tf
问题出现了…
UserWarning: h5py is running against HDF5 1.10.5 when it was built against 1.10.4, this may cause problems
解决办法:
pip uninstall h5py
pip install h5py
之后再次测试:
import tensorflow as tf
print(tf.__version__)
输出2.1.0 这样就成功了
6.打开Anaconda Navigator,在environment中可以看见TensorFlow,在uninstall里可以安装spyder,ipython,和jupyter,这样就可以在这些里面使用tensorflow
7.打开Jupyter Notebook测试tensorflow
import tensorflow as tf
print(tf.__version__)
输出2.1.0
完成!