admin管理员组

文章数量:1487745

【已解决】AttributeError: module ‘nmap‘ has no attribute ‘PortScanner‘

报错

AttributeError: module ‘nmap’ has no attribute ‘PortScanner’

解决方案

必要的解决方法

抛出异常的原因是因为没有指定nmap的执行路径所致,在windows下需要手动指定nmap的执行路径。

下载安装nmap

.html

代码中添加exe路径
代码语言:javascript代码运行次数:0运行复制
nm = nmap.PortScanner(nmap_search_path=('nmap',r"F:\Nmap\nmap.exe"))
可能有用的解决方法

对应的应为python-nmap包,而非nmap包

代码语言:javascript代码运行次数:0运行复制
pip uninstall nmap
pip install python-nmap

可能需要重启一下电脑 Good Luck!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2023-04-26,如有侵权请联系 cloudcommunity@tencent 删除modulepip解决方案异常attributeerror

本文标签: 已解决AttributeError module nmap has no attribute PortScanner