1.下载Xcode
2.安装Miniforge
点击这里
链接:https://github.com/conda-forge/miniforge
下载到本地,执行
bash Miniforge3-MacOSX-arm64.sh
基本都是回车 *** 作,中间输入一次yes,就安装好了
3.确认Miniforge安装成功
4.创建conda环境
执行:
conda create --name python38 python=3.8
可以通过下面命令确认已经创建好conda环境。
conda env list
激活环境:
conda activate python38
注:如果激活环境出现问题,可以尝试执行下面语句
#重新进入虚拟环境 source activate #退出虚拟环境 conda deactivate
再重新执行激活环境的命令即可解决
5.下载tensorflow
下载地址:https://github.com/apple/tensorflow_macos/releases,选择tar.gz的包下载。
解压:
tar -xvf tensorflow_macos-0.1alpha3.tar.gz
6.安装依赖
download_path="~/Downloads/tensorflow_macos/arm64/" target_path="~/miniforge3/env/python38/" # 安装相关依赖 pip install --upgrade -t "$target_path/lib/python3.8/site-packages/" --no-dependencies --force "$download_path/grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl" pip install --upgrade -t "$target_path/lib/python3.8/site-packages/" --no-dependencies --force "$download_path/h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl" pip install --upgrade -t "$target_path/lib/python3.8/site-packages/" --no-dependencies --force "$download_path/tensorflow_addons_macos-0.1a2-cp38-cp38-macosx_11_0_arm64.whl" pip install --upgrade -t "$target_path/lib/python3.8/site-packages/" --no-dependencies --force "$download_path/numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl"
中间可能会提示需要安装的库:
# 安装相关库 conda install -c conda-forge -y absl-py conda install -c conda-forge -y wheel conda install -c conda-forge -y typing_extensions conda install -c conda-forge -y gast conda install -c conda-forge -y opt_einsum conda install -c conda-forge -y termcolor conda install -c conda-forge -y typeguard
安装tensorflow
pip install --upgrade -t "$target_path/lib/python3.8/site-packages/" --no-dependencies --force “$download_path/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)