[英]Python scapy import error
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. 在Console和IDLE中都是如此,但不是eclipse。 I am very much confused why this is happening.
我很困惑为什么会发生这种情况。 Can some one help me out?
有人可以帮我吗?
如果系统中未安装scapy,则可以使用此命令安装scapy:
sudo apt-get install python-scapy
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! 希望有所帮助!
删除任何名为scapy.py的文件
I think there was a change is scapy somewhere. 我觉得有些变化是scapy。 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
If you use Linux get this folder: 如果您使用Linux获取此文件夹:
/usr/share/pyshared
If you not found scapy
you 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。
如果未安装scapy,请使用以下命令安装:
sudo apt-get install python-scapy
I want to contribute to this problem. 我想为这个问题做出贡献。 Watch for files named "scapy" in your directory where u are using your script.
在您使用脚本的目录中查看名为“scapy”的文件。 I had one named "scapy.py" and obviously python tries to include from ".".
我有一个名为“scapy.py”,显然python试图包含“。”。 I removed script and: import scapy.all import * works fine.
我删除了脚本和:import scapy.all import *工作正常。
from kamene.all import * WARNING: No route found for IPv6 destination :: (no default route?).
来自kamene.all import *警告:找不到IPv6目标::(没有默认路由?)的路由。 This affects only IPv6
这仅影响IPv6
Use this one instead of scapy.all
使用这个而不是scapy.all
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.