“zsh:非法硬件指令python"在 macbook pro M1 上安装 Tensorflow 时 [英] "zsh: illegal hardware instruction python" when installing Tensorflow on macbook pro M1
问题描述
我正在尝试让 tensorflow 在我的 MacBook pro M1 上运行.但是,我在尝试导入时不断收到以下错误:zsh:非法硬件指令python
我已通过此链接下载并安装了 tensorflow.>
这些是我的安装步骤:
- 安装 venv:
python3 -m venv venv
. - 将
install_venv.sh
(位于下载的文件夹中)文件拖到终端,在末尾添加-p
. - 选择 venv 的目录作为应安装 tensorflow 的位置.
- 激活venv.
- 输入python".
- 尝试导入tensorflow:
import tensorflow as tf
.
我使用的是 Python 3.8.2.
我看过一些教程,这种方法确实有效,所以我不知道这里有什么问题.
我找到了答案.似乎我的终端应用程序在 Rosetta 中运行.这可以通过右键单击应用程序来更改 ->获取信息 ->禁用使用 rosetta 打开".
I'm trying to get tensorflow working on my MacBook pro M1. However, I keep getting the following error when trying to import: zsh: illegal hardware instruction python
I have downloaded and installed tensorflow via this link.
These were my installation steps:
- install a venv:
python3 -m venv venv
. - drag the
install_venv.sh
(which is located within the downloaded folder) file to the terminal, add-p
at the end. - select the directory of the venv as the location where tensorflow should be installed.
- activate the venv.
- type "python".
- try to import tensorflow:
import tensorflow as tf
.
I'm using Python 3.8.2.
I've seen some tutorials where this exact method does work, so I don't know what's the issue here.
I've found the answer. Seemed like my terminal app was running in Rosetta. This can be changed by right clicking on the app -> get info -> disable "open with rosetta".
这篇关于“zsh:非法硬件指令python"在 macbook pro M1 上安装 Tensorflow 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!