修改源镜像
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --set show_channel_urls yes
创建环境
conda create --name py3 python=3.5
conda info --envs
activate py3
deactivate
Linux环境下前面要加 source
使用pip安装
python -m pip install --upgrade pip
pip install --upgrade --ignore-installed tensorflow
使用conda安装
conda install tensorflow
import tensorflow as tf
hello = tf.constant('Hello,tensorflow')
sess = tf.Session()
print(sess.run(hello))
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
错误原因参考
配置jupyter
pip install ipykernel
python -m ipykernel install --name tf
重新设置DNS,使用github
进入 C:\Windows\System32\drivers\etc\hosts
151.101.72.249 global-ssl.fastly.Net
192.30.253.112 github.com