win10环境下,anaconda安装TensorFlow2.0

anaconda创建虚拟环境

此步骤略过,可参照https://blog.csdn.net/weixin_42185400/article/details/105144890

安装TensorFlow

注意要在虚拟环境下执行指令,否则会被安装到活跃环境中。

1、安装cpu版本(使用清华源)
##进入虚拟环境
conda activate TensorFlow
##安装TensorFlow2.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow2.0.0-alpha0
##检验时候安装成功
win10环境下,anaconda安装TensorFlow2.0
如图所示,导入TensorFlow出现问题,是由于numpy的包版本引起的,解决方案如下:
经过测试,导入numpy1.16.0可以兼容TensorFlow2.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
1.16.0

安装jupyter notebook

通过jupyter notebook可以连接虚拟环境进行编程

##安装jupyter
conda install jupyter notebook

##运行jupyter
jupyter notebook

##测试tensorflow是否安装成功
win10环境下,anaconda安装TensorFlow2.0