【问题标题】:Process finished with exit code 132 (interrupted by signal 4: SIGILL) - Tensorflow Certification Exam进程以退出代码 132 结束(被信号 4:SIGILL 中断) - Tensorflow 认证考试
【发布时间】:2022-08-20 01:05:00
【问题描述】:

我最近购买了 M1 Pro MacBook 并想参加 Tensorflow 认证考试,但在 PyCharm 中导入 Tensorflow 时遇到了错误。

以下是我按照Tensorflow guideline 执行的步骤:

  1. 安装 Python 3.8:
  2. 安装 PyCharm 2021.3:
  3. 在 PyCharm 中创建了项目
  4. 按照指南安装在 python 依赖项下:
    tensorflow==2.7
    tensorflow-datasets==4.6.0
    Pillow==9.1.1
    pandas==1.4.2
    numpy==1.22.4
    scipy==1.7.3
    

    现在,当我在 python 脚本中导入 tensorflow 时,它会抛出:Process finished with exit code 132 (interrupted by signal 4: SIGILL) 错误。

    我搜索了上面提到的错误,发现 python 解释器和 tensorflow 的架构存在一些问题。但是我已经安装了 x86_64 架构的 python 和 pycharm。

  • 您是否从终端运行 Python 脚本?在这种情况下,可能有更多关于错误的信息。
  • @MikkoOhtamaa zsh: illegal hardware instruction python3 main.py 这是我从终端运行脚本时遇到的错误。当我从 PyCharm 运行脚本时,/Users/hemendra/PycharmProjects/pythonProject/venv/bin/python /Users/hemendra/PycharmProjects/pythonProject/main.py Process finished with exit code 132 (interrupted by signal 4: SIGILL) 是错误消息。
  • @MikkoOhtamaa 在参加 tensorflow 认证考试时,tensorflow 插件将创建新的环境并安装 tensorflow。有时,我可以使用提供的链接中提到的轮子手动安装 tensorflow 吗?我在哪里可以找到 tensorflow==2.7 链接?在链接中只给出了 2.4 链接。
  • 不幸的是,我没有 tensorflow 的经验来指导你,只有 PyCharm。我的建议是,如果是考试,那么考试组织者需要为您提供所需的支持,以确保所有参与者都可以轻松设置和复制环境。

标签: python tensorflow pycharm


【解决方案1】:

你见过这个 GitHub thread 吗?

他们建议更新证书,例如this

open /Applications/Python\ 3.7/Install\ Certificates.command

抱歉,我无法测试它,我没有 M1,显然这个错误发生在 Apple Silicon 下。看看它是否有效。


有关如何通过 PyCharm 设置环境的信息:

  1. 创建项目
  2. 转到窗口的右下角并按<No interpreter>,然后按Add Interpreter。您会发现创建环境的不同方法。如果你有 Conda 或 Virtualenv,我建议你使用它。无论哪种方式选择“新环境”。选择位置和 python 版本。按确定。现在你有了一个可以安装所有包的环境。
  3. 等待 PyCharm 终止构建所有内容。
  4. 转到终端选项卡。你应该在环境中。您可以查看路径的左侧来验证它。您应该在路径前看到类似(your_env_name) 的内容。
  5. 在终端内安装pip install 列出的所有软件包。

【讨论】:

  • 安装证书并没有解决问题。
  • 看到我已经更新了答案
猜你喜欢
  • 2018-02-03
  • 2021-05-10
  • 1970-01-01
  • 2021-03-22
  • 2021-07-21
  • 1970-01-01
相关资源
最近更新 更多