解决Mac M1 无法安装paddlepaddle问题
简介
首先,目前paddle官方没有支持M1芯片,但是M1芯片支持Rosetta转译x86。
但我们又不想直接在Mac自带python环境上安装python包,可以尝试使用【miniforge】。
miniforge原生支持 Apple Silicon M1,但miniforge的python是不支持rosetta2转译的,可以强制设置为rosetta2转移的python去安装。
安装环境
以下步骤已在该环境下验证成功,测试环境:
MacBook Pro (13-inch, M1, 2020)
macOS Big Sur 11.4 (20F71)
安装步骤
CONDA_SUBDIR=osx-64 conda create -n ppocr_rosetta python=3.7
conda activate ppocr_rosetta
python -c "import platform;print(platform.machine())"
conda env config vars set CONDA_SUBDIR=osx-64
conda deactivate
conda activate ppocr_rosetta
echo "CONDA_SUBDIR: $CONDA_SUBDIR"
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
验证环节
进入python解释器,验证:
>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
PaddlePaddle works well on 1 CPU.
W0904 23:21:10.721201 9092608 fuse_all_reduce_op_pass.cc:76] Find all_reduce operators: 2. To make the speed faster, some all_reduce ops are fused during training, after fusion, the number of all_reduce ops is 2.
PaddlePaddle works well on 2 CPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
参考链接:https://github.com/conda-forge/miniforge/issues/165
|