在 mac m1 上使用非 macOS 版本的 tensorflow

时间:2021-03-22 17:40:51

标签: python python-3.x macos tensorflow apple-m1

我最近购买了一台带有 M1 内核的新 Mac 笔记本电脑。我以前使用 tensorflow 完成了工作,并且正在尝试继续使用我的新笔记本电脑。我知道苹果有一个 tensorflow_macos 版本的 tensorflow,但不幸的是,对于我的项目,我需要更高阶的导数,而 fork 目前无法做到这一点。有没有办法在 M1 上运行非 mac 特定版本的 tensorflow?

如果我尝试从 arm 终端导入 tensorflow,我会收到错误:

python3
import tensorflow
zsh: illegal hardware instruction  python3

如果我从 Rosetta 终端运行,也会发生同样的情况。

我也尝试从 PyCharm 运行(使用 Python 3.8 虚拟环境),但在尝试导入 tensorflow 时遇到了不同的问题:

Process finished with exit code 132 (interrupted by signal 4: SIGILL)

我安装了 python3.8.5。我在其他相关问题上看到,mac上默认安装了两个版本的python3(arm和x86_64),但看起来我只有一个版本:

file $(which python3)
/Users/xxx/opt/miniconda3/bin/python3: Mach-O 64-bit executable x86_64

我在处理不同的核心架构方面经验不足,所以任何建议都将不胜感激。我很乐意提供任何细节的说明。

0 个答案:

没有答案