Python scapy 导入错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4273936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 15:02:26  来源:igfitidea点击:

Python scapy import error

pythonscapy

提问by rda3mon

If I include following line in my python source file

如果我在 python 源文件中包含以下行

from scapy.all import *

I get this error

我收到这个错误

from scapy.all import *
ImportError: No module named all

Which is true in Console and IDLE, but not eclipse. I am very much confused why this is happening. Can some one help me out?

这在 Console 和 IDLE 中是正确的,但在 eclipse 中则不然。我非常困惑为什么会发生这种情况。有人可以帮我吗?

采纳答案by dc5553

I think this may be a problem with your version:

我认为这可能是您的版本有问题:

If you are using Scapy v1.X:

如果您使用的是 Scapy v1.X:

from scapy import *

Otherwise, with Scapy V2.X+

否则,使用 Scapy V2.X+

from scapy.all import *

Is the way to go.

是要走的路。

Hope that helps!

希望有帮助!

回答by AJ00200

I think there was a change is scapy somewhere. I put the following code in my scapy projects so it remains compatible.

我认为某处发生了变化。我将以下代码放在我的 scapy 项目中,以便它保持兼容。

try:
    import scapy
except ImportError:
    del scapy
    from scapy import all as scapy

回答by A1Gard

If you use Linux get this folder:

如果您使用 Linux,请获取此文件夹:

/usr/share/pyshared

If you not found scapyyou must download and install this, for example for Ubuntu you can found this:

如果你没有找到scapy你必须下载并安装它,例如对于 Ubuntu 你可以找到这个:

http://packages.ubuntu.com/precise/all/python-scapy/download

http://packages.ubuntu.com/precise/all/python-scapy/download

and download package and install this pack about 300 kb.

并下载包并安装此包约 300 kb。

回答by Snake Eyes

If scapy is not installed in your system, then you can use this command to install scapy:

如果你的系统中没有安装 scapy,那么你可以使用这个命令来安装 scapy:

sudo apt-get install python-scapy

sudo apt-get install python-scapy

回答by Utopia

Delete any file named scapy.py

删除任何名为 scapy.py 的文件

回答by Utopia

If scapy is not installed, please install with this command:

如果未安装 scapy,请使用以下命令安装:

sudo apt-get install python-scapy

回答by romanikov

I want to contribute to this problem. Watch for files named "scapy" in your directory where u are using your script. I had one named "scapy.py" and obviously python tries to include from ".". I removed script and: import scapy.all import * works fine.

我想为这个问题做出贡献。在您使用脚本的目录中注意名为“scapy”的文件。我有一个名为“scapy.py”的,显然python试图从“.”中包含。我删除了脚本并且: import scapy.all import * 工作正常。

回答by user11806510

from kamene.all import * WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6

Use this one instead of scapy.all

from kamene.all import * WARNING: No route found for IPv6 destination ::(没有默认路由?)。这仅影响 IPv6

使用这个而不是 scapy.all