python - 无法在 Apple M1 芯片中为 python django 安装 firebase-admin pip 包
问题描述
无法在 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-adminpip 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 管理员的问题。
解决方案
尝试运行以下命令:
arch -arch x86_64 /usr/bin/python3 -m pip install firebase-admin
grpc 似乎没有为 M1 mac 提供支持。
以下是相关的github问题:
推荐阅读
- python - 如何选择 statsmodels STL 函数的正确参数?
- javascript - 在javascript中替代Uint8Array?
- c# - 有没有办法让 JSON.net 尊重 System.Text.Json JsonPropertyName 属性
- javascript - 如何从中间件将错误返回给 ExpressJS?
- mailchimp - 获取 Mailchimp 活动点击的时间戳和成员的电子邮件
- regex - Dart Regexp 替换除数字之外的所有内容并允许一次。或者 ,
- php - react axios没有看到php文件路径
- powershell - 从对象数组初始化哈希表?
- android - Android 的 NavDeepLinkBuilder 没有不清除任务的选项
- r - 有没有办法在 R 中与 seq 相乘?