Python nmap portscanner错误

时间:2014-02-02 22:05:48

标签: python python-3.x error-handling nmap

我只是想创建一个nmap.PortScanner()对象。但是,每当我运行这行代码时,我都会收到以下错误

>>> import nmap
>>> nmap.PortScanner()
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    nmap.PortScanner()
  File "C:\Python32\lib\site-packages\nmap\nmap.py", line 170, in __init__
raise PortScannerError('nmap program was not found in path. PATH is : {0}'.format(os.getenv('PATH')))
nmap.nmap.PortScannerError: 'nmap program was not found in path. PATH is : C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C:\\Program Files (x86)\\QuickTime\\QTSystem\\'

我已经通过运行'python setup.py install'安装了nmap 如何让nmap正常工作?

1 个答案:

答案 0 :(得分:1)

  1. 确保安装nmap并将其添加到文件路径中。
  2. 我正在使用python 2.7并且一直存在问题,这是修复: