Python Nmap路径错误

时间:2012-10-17 18:40:01

标签: python nmap

Python导入NMap很好,但是当我做一个基本的变量赋值时,它会返回一个错误:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    nm = nmap.PortScanner()
  File "C:\Python32\lib\site-packages\nmap\nmap.py", line 144, 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:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\DMIX;C:\\Program Files (x86)\\Microsoft SQL Server\\90\\Tools\\binn\\;C:\\Python32\\Lib\\;C:\\Python32\\Tools\\Scripts;C:\\Program Files (x86)\\Common Files\\Intuit\\QBPOSSDKRuntime;C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin;C:\\Program Files (x86)\\Java\\jdk1.7.0_05;C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\jre\\bin\\client;C:\\Program Files (x86)\\Android;N:\\PortableApps\\Android_SDK\\tools;N:\\PortableApps\\Android_SDK\\platform-tools;C:\\Python32;C:\\Python32\\Lib;C:\\Python32\\Scripts;C:\\Python32\\Lib\\site-packages;C:\\Python32\\Lib\\site-packages\\android.py;C:\\Python32\\Lib\\site-packages;C:\\Python32\\Lib\\site-packages\\nmap'

1 个答案:

答案 0 :(得分:3)

我也遇到过这个问题。我通过安装nmap解决了这个问题。在PATH变量中添加nmap.exe目录后,我不再遇到此问题了。