一、使用conda创建虚拟环境
创建环境:
//下面是创建python=3.6版本的环境,取名叫py36
conda create -n tf python=3.6
激活环境
conda activate tf
退出环境
conda deactivate
删除环境(不要乱删啊啊啊)
conda remove -n tf --all
二、安装jupyter notebook
anaconda官网搜索安装包:https://anaconda.org/anaconda/
conda install -c anaconda notebook
启动命令:
python -m IPython notebook
三、在conda中安装tensorflow
安装CPU版
pip install --ignore-installed --upgrade tensorflow
安装GPU版
pip install --ignore-installed --upgrade tensorflow-gpu
四、测试
import tensotflow
msg = tf.constant('TensorFlow 2.0 Hello World')
tf.print(msg)
输出:
TensorFlow 2.0 Hello World