不能导入scapy

时间:2018-01-09 06:06:33

标签: python python-3.x pycharm scapy

我正在尝试导入scapy,但它会出现以下错误。

from scapy.all import *

server_list = list()

def get_server():
    while True:


> from scapy.all import * Traceback (most recent call last):   File
> "<input>", line 1, in <module>   File "C:\Program
> Files\JetBrains\PyCharm Community Edition
> 2017.3.2\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
>     module = self._system_import(name, *args, **kwargs)   File "C:\Users\Home
> PC\PycharmProjects\testpro\venv\lib\site-packages\scapy\all.py", line
> 16, in <module>
>     from .arch import *   File "C:\Program Files\JetBrains\PyCharm Community Edition
> 2017.3.2\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
>     module = self._system_import(name, *args, **kwargs)   File "C:\Users\Home
> PC\PycharmProjects\testpro\venv\lib\site-packages\scapy\arch\__init__.py",
> line 95, in <module>
>     from .windows import *   File "C:\Program Files\JetBrains\PyCharm Community Edition
> 2017.3.2\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
>     module = self._system_import(name, *args, **kwargs)   File "C:\Users\Home
> PC\PycharmProjects\testpro\venv\lib\site-packages\scapy\arch\windows\__init__.py",
> line 23, in <module>
>     from scapy.arch import pcapdnet   File "C:\Program Files\JetBrains\PyCharm Community Edition
> 2017.3.2\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
>     module = self._system_import(name, *args, **kwargs)   File "C:\Users\Home
> PC\PycharmProjects\testpro\venv\lib\site-packages\scapy\arch\pcapdnet.py",
> line 32, in <module>
>     from .winpcapy import *   File "C:\Program Files\JetBrains\PyCharm Community Edition
> 2017.3.2\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
>     module = self._system_import(name, *args, **kwargs)   File "C:\Users\Home
> PC\PycharmProjects\testpro\venv\lib\site-packages\scapy\arch\winpcapy.py",
> line 26, in <module>
>     _lib=CDLL('wpcap.dll')   File "C:\Users\Home PC\AppData\Local\Programs\Python\Python36\Lib\ctypes\__init__.py",
> line 348, in __init__
>     self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found

我读到反斜杠是转义字符,因此,我们可能必须使用“\\”来导入它。

我正在使用Pycharm并且不确定如何做到这一点,任何帮助都会非常感激。

1 个答案:

答案 0 :(得分:0)

当我在当前目录中有scapy.py时,我看到了这一点。 scapy.all import *似乎首先在当前目录中查找。 尝试from scapy import allimport scapy.all