Requirements
- Mac computers with Apple silicon
- macOS 12.0 or later (Get the latest beta)
- Python 3.8 or later
- Xcode command-line tools:
xcode-select --install
Get started
1. Set up
arm64 : Apple silicon,Download Conda environment
bash ~/miniconda.sh -b -p $HOME/miniconda #更改为下载地址
source ~/miniconda/bin/activate #更改外activate的地址
conda config --add channels conda-forge
conda config --set channel_priority strict
#创建环境
conda create -n tensorflow python==3.9
conda activate tensorflow
2. Install base TensorFlow
conda install -c apple tensorflow-deps
python3 -m pip install tensorflow-macos
3. Install tensorflow-metal plug-in
python3 -m pip install tensorflow-metal
4. 检测环境
conda env list
jupyter kernelspec list
到此,对于M1下的TensorFlow环境就算是按照完了,最后我们再来看如何配置IDE环境。
IDE配置
使用Jupyter Lab,安装常用的packages
conda install jupyter jupyterlab pandas matplotlib seaborn nltk spacy scikit-learn nb_conda
打开Jupyter lab,查看tensorflow版本
source ~/miniforge3/bin/activate
conda activate tensorflow
jupyter lab
import tensorflow as tf
tf.__version__
如果已经处于tensorflow环境,直接输入jupyter lab
即可,如果重新进入终端需要先输入前两行进入tensorflow环境。
亲自测试可以安装成功。
原创文章(本站视频密码:66668888),作者:xujunzju,如若转载,请注明出处:https://zyicu.cn/?p=15998