简体   繁体   English

导入模块时出现Scapy问题

[英]Scapy problems when importing modules

I recently started programming in python and scapy. 我最近开始使用python和scapy进行编程。 But when i use from scapy.all import * it doesnt work and i get the exception ImportError: No module named 'base_classes'. 但是当我从scapy.all import *使用时,它不起作用,并且出现异常ImportError:没有名为“ base_classes”的模块。 So it is finding the folder all, but cannot find base_classes. 因此,它正在查找所有文件夹,但找不到base_classes。 I verified however that base_classes is actually in there. 我验证了base_classes实际上在那里。 In extend, import scapy.all.base_classes finds that there are base_classes in there but when i execute it i stil get an error. 在扩展中,导入scapy.all.base_classes发现那里存在base_classes,但是当我执行它时,仍然出现错误。 What should i do? 我该怎么办? i verified my version of scapy and it is 2.x. 我验证了我的Scapy版本,它是2.x。

Thank you Martinos 谢谢你马蒂诺斯

I ran into a similar issue once and it was because I wasn't using the right version of python and the right python path. 我曾经遇到过类似的问题,这是因为我没有使用正确的python版本和正确的python路径。

I solved it by adding the right classes to the path in the beginning of my script using 我通过使用脚本的开头在路径中添加正确的类来解决此问题

import sys
sys.path.append("/home/me/mypy")

It's a bit ugly but it worked. 这有点丑陋,但确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM