python - 无法在 Mac M1 上安装 TensorFlow。安装过程中遇到错误
问题描述
我对编程很陌生,我正在尝试在我的机器上安装 tensorflow。我的 Macbook 有 M1 芯片,当你想要 tensorflow 时,它显然会让生活变得艰难。我在 youtube 上跟着一个人,我被困在最后一步。我设置了一个 anaconda 虚拟环境,当我运行这个安装文件时它甚至说它是成功的install_venv.sh
(来自 MacOS tensorflow/github 页面...... https://github.com/apple/tensorflow_macos/releases)
但是,当我运行import tensorflow as tf
它时,它会引发此错误(对不起,长度,包括整个错误,所以我不会错过任何东西)请有人帮忙,也许教我为什么会这样。
我一直试图让 tensorflow 工作几个小时!
Traceback (most recent call last):
File "/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/jacobholmes/opt/anaconda3/envs/test_opencv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
>>> /Users/jacobholmes/Downloads/tensorflow_macos/ins
解决方案
推荐阅读
- javascript - 如果帖子早于 [设置天数],则显示/隐藏徽章/标签
- python - 在python中创建柱状图/饼图
- python - 如果它们在另一个列表中,则删除列表的标记(提高速度)
- performance - 尝试运行脚本时 Jmeter 显示错误
- reactjs - React useState 返回旧值
- javascript - JavaScript 函数 -- 下一页
- javascript - 从 JSON ReactJS 渲染数据:数据不显示为列
- java - Spring @Transactional 上如何处理对象锁
- javascript - 如何将 ng-repeat 中的对象添加到控制器数组($scope)中?
- impala - Impala Hue Cloudera:如何从数据集中的给定列“帐户已打开”和“帐户已关闭”(均为整数)中查找任期