1、终端运行

#创建一个名为 tensorflow 的 conda 环境 具体根据自身情况替换末尾的python版本
conda create -n tensorflow python=3.8

#激活 conda 环境

conda activate tensorflow

MacOS Anaconda下python3.8安装tensorflow

2、安装tensorflow2

#在conda 环境中安装 TensorFlow

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ tensorflow==2.6

MacOS Anaconda下python3.8安装tensorflow

 PS:本来使用命令:pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.6.0-cp38-cp38-macosx_10_11_x86_64.whl

但是由于网络问题,经常下载不下来,出错,因此使用上述清华镜像进行安装。

3、测试是否安装成功

#打开Python

python3

#检测版本

import tensorflow as tf

tf.__version__

MacOS Anaconda下python3.8安装tensorflow

#退出python

exit()

4、退出tensorflow环境

conda deactivate

 

 

相关文章:

  • 2021-05-28
  • 2021-10-11
  • 2021-12-28
  • 2021-04-13
  • 2021-10-17
  • 2021-06-28
  • 2021-05-19
  • 2021-07-03
猜你喜欢
  • 2021-06-19
  • 2021-04-27
  • 2021-05-10
  • 2021-12-30
  • 2022-12-23
  • 2021-10-16
  • 2021-07-19
相关资源
相似解决方案