无法在 Apple M1 芯片系统中安装 firebase-admin
系统配置
System OS: macOS Bigsur(11.2.2)
chip: Apple M1
python version: 3.9.2
Pip Version: 20.0.1
Djnago: 3.1.7
我使用以下步骤为我的项目创建虚拟环境
install virtualenv using pip install virtualenv
virtualenv venv -p python3.x
(随心所欲)source /your_project/venv/bin/activate
venv
将激活,然后您可以在 pip 的帮助下安装需求在此之后,我尝试安装 firebase-admin pip install firebase-admin
并且出现如下错误
File "/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-build-env-aapo6r5y/normal/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__
import _cffi_backend as backend
ImportError: dlopen(/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-build-env-aapo6r5y/normal/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 2): no suitable image found. Did find:
/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-build-env-aapo6r5y/normal/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so: mach-o, but wrong architecture
/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-build-env-aapo6r5y/normal/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so: mach-o, but wrong architecture
File "/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-install-yurwgn0k/grpcio_2bb9c0d1fcb8462591aa5aa845bcb162/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-install-yurwgn0k/grpcio_2bb9c0d1fcb8462591aa5aa845bcb162/src/python/grpcio/commands.py", line 250, in new_compile
return old_compile(obj, src, ext, cc_args, extra_postargs,
File "/opt/homebrew/Cellar/python@3.9/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for grpcio
ERROR: Command errored out with exit status 1: /Volumes/DATA-D/user/Project/project_name/Api/fitquid/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-install-yurwgn0k/grpcio_2bb9c0d1fcb8462591aa5aa845bcb162/setup.py'"'"'; __file__='"'"'/private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-install-yurwgn0k/grpcio_2bb9c0d1fcb8462591aa5aa845bcb162/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2l/g855nfq11js0q9s9dc9ygk000000gn/T/pip-record-jmxgwm9r/install-record.txt --single-version-externally-managed --compile --install-headers /Volumes/DATA-D/Drashti/Project/Fitquid/Api/webapis/fitquid/venv/include/site/python3.9/grpcio Check the logs for full command output.
如果尝试安装 pip install boto3
、pip install django
等软件包,但只有 firebase 管理员才能正常工作。
答案 0 :(得分:1)
尝试运行此命令:
arch -arch x86_64 /usr/bin/python3 -m pip install firebase-admin
似乎 grpc 不提供对 M1 macs 的支持。
这里是相关的github问题:
答案 1 :(得分:0)
你可以试试这个,因为这可能是问题所在:
首先升级pip
pip3 install --upgrade pip
然后,更新设置工具:
python3 -m pip install --upgrade setuptools
最后,使用 :
安装 grpciopip3 install --no-cache-dir --force-reinstall -Iv grpcio==<version_number>
答案 2 :(得分:0)
这些公认的答案似乎都不起作用,但这里的最佳答案对我有用。 How can I install GRPCIO on an Apple M1 Silicon laptop?