python 导入 scapy 时卡住

python gets stuck when importing scapy

我正在学习使用 scapy,虽然它在解释器中运行良好,但我在使用它创建 .py 文件时遇到了问题。每当我尝试使用

from scapy.all import *

程序卡住并给出休闲警告:

WARNING: No route found for IPv6 destination :: (no default route?)

我尝试按照之前对类似问题的回答中的建议隐藏警告:

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)

但是当我这样做时,代码仍然卡在导入行上而没有显示警告。如有任何帮助,我们将不胜感激。

+添加评论解释为什么这个问题不是重复的

过去遇到过这个问题,请尝试从 cmd window 而不是 PyCharm.

启动你的 Python 文件

如果您不知道该怎么做:

Open file location > Shift + Right click > Choose "open command window here" > type "python **file name**"

本来可以在评论中提出这个建议,但我没有足够的代表支持。