转载自:https://blog.csdn.net/wangwangstone/article/details/103588071
Anaconda python3.64 -TensorFlow1.131 Mac下
环境搭建 :
Anaconda下载安装
版本对应关系:https://blog.csdn.net/yuejisuo1948/article/details/81043823
选择里面的清华镜像源:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=N&O=D
Anaconda3-5.1.0 (python 3.6.4)
点击安装后,一切选择的默认安装。
Mac 下进入terminal
查看已有环境
环境操作
conda info --env
创建环境
建立名字为tf1.13的环境,指定python版本为3.6
弹出proceed后输入y
后面会弹出source activate的提示前面所需的安装包没问题了。
如果要删除环境
conda remove -n tf1.13 --all |
为conda添加国内镜像源:
# 添加Anaconda的清华镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# TUNA的help中镜像地址加有引号,需要去掉
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes
激活环境
source activate tf1.13 |
退出环境
source deactivate |
安装指定版本
conda install --channel https://conda.anaconda.org/anaconda tensorflow=1.13 |
验证TF是否安装成功
python
>>> import tensorflow as tf
#弹出一系列的warning与提示,暂时不管。
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
##会输出b'hello,tensorflow'
print(tf.__version__)