尝试导入 tensorflow 时出现非法硬件指令 [英] Illegal hardware instruction when trying to import tensorflow

查看:113
本文介绍了尝试导入 tensorflow 时出现非法硬件指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用 virtualenv 方法的说明安装了 tensorflow.安装过程很顺利,所以我认为那里没有任何问题.安装后,我继续尝试导入它以验证一切正常,我收到以下消息:

I just installed tensorflow using the instructions for the virtualenv method. The installation process went smoothly, so I don't think there was any problem there. After installation I proceeded to try and import it to validate that everything is ok, and I got the following message:

[1]    4492 illegal hardware instruction (core dumped)  python

这是在我使用 python 交互式控制台使用以下命令后发生的:

This happened after I use the following command using th python interactive console:

import tensorflow as tf

我尝试使用带有 pip 的链接重新安装它,但没有成功.

I tried using the link with pip to reinstall it, but no success.

我使用以下命令创建了 virtualenv:

I have created the virtualenv with:

python3.6 -m venv venv

在这不起作用之后(因为它产生了同样的错误)我尝试了:

After this didn't work (as in it generated the same error) I tried with:

virtualenv --system-site-packages -p python3.6 venv

我得到了相同的结果.

我用来安装 tensorflow 的命令是:

The command I used to install tensorflow was:

pip install tensorflow

如您所见,我打算安装仅限 CPU 的版本.

As you can see, I intend to install the CPU-only version.

我阅读了一些关于其他框架和技术的想法,这些框架和技术显示此消息,硬件没有实现指令,因此除了获得新硬件之外别无他法.

I read some think about other frameworks and technologies that show this message em the hardware does not have the instruction implemented, so there's nothing to do about that except getting new hardware.

有什么办法可以解决这个问题吗?我已经尝试了一些不同的安装方法,但都没有看到工作

Is there any way to fix this issue? I already tried some different installation methods, but none of then seen to work

至于系统规格:

OS = Ubuntu 16.04 x64 LTS
Python = Python 3.6
pip version = 9.0.1
tensorflow version = TensorFlow 1.6.0
CPU = Intel Core 2 Quad Q6600  @2.40GHz

OBS:我在这台机器上确实有一个 GPU,但我认为 tensorflow 不会在它上面运行,因为它有点旧.它是 Nvidia 8800 GTS 512.

OBS: I do have a GPU on this machine, but I don't think that tensorflow will run on it, since it is kind of old. It's a Nvidia 8800 GTS 512.

感谢您的帮助,如果有任何遗漏的信息,请告诉我.

I appreciate any help, and if there's any missing info, please let me know.

推荐答案

我刚刚发现:

运行 import tensorflow 后的非法指令(核心转储)

这个问题似乎是由一些旧处理器(AVX 指令集)中未实现的硬件指令集引起的.由于它们不是在硬件中实现的,因此这个问题没有真正的解决方法.

This problem seems to be caused by a set of instructions that are not hardware implemented in some older processors (AVX instruction set). Since they are not implemented in hardware, there's no real fix for this problem.

如果我理解正确,解决方法是将 tensorflow 从 1.6.0 降级到 1.5.0,这也适用于 GPU 版本.它对我有用.

If I understood it correctly, and a workaround is to downgrade tensorflow from 1.6.0 to 1.5.0, this also applies to the GPU version. It worked for me.

我暂时将其标记为已回答,但如果有人对如何让 1.6.0 版本工作有任何好主意,请告诉我.

I Will mark this as answered for now, but if anyone have any good idea how to get version 1.6.0 working, please let me know.

这篇关于尝试导入 tensorflow 时出现非法硬件指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆