('Nmap not found', <class 'nmap.nmap.PortScannerError'>)
For Windows users:
I would suggest first closing all terminals and IDLE or any other window you currently have opened when trying to run your script.
Next, open a command line and type
pip uninstall python-nmap
If you are unsure if Nmap binaries are installed on your current system, do a simple search for
nmap
from your start menu. If it is installed, continue to the next step, if not, go to Nmap's official download page
Download the windows self install and run it. Record the directory it is being installed to.
Go to that directory. For me it was
C:\Program Files (x86)\Nmap
Open your system's environment variables editor usually found in
My PC > System Information > Advance settings > Environment Variables
Or right click
My PC or My Computer or whatever yours is called and select properties then advance settings then Environment Variables at the bottom of the Advanced tab
select Path
for both You
and the System
press Edit
and enter the full path to your Nmap director
eg ;C:\Program Files (x86)\Nmap\
Press ok and exit the editor.
Now go back to your command line and enter: pip install python-nmap
Allow it to install and then restart your ide
and test your code again.
python-nmap
seems to depend on nmap
, which is the binary that does the actual network scanning and auditing.
You can check in a terminal if nmap is in your $PATH
with the following command:
which nmap
Debian-like
You can install nmap in debian-like distros with:
apt-get install nmap
Arch linux:
pacman -Sy nmap
Already installed nmap
If you're sure the nmap
binary is installed, but you think it is not in your $PATH
, you might have to add the directory where nmap is installed to your $PATH
.
To do that, edit the .bashrc
file in your user's directory, or /etc/bashrc
(which will change for all users) and add the following:
export PATH="$PATH:/usr/local/nmap/bin"
but changing /usr/local/nmap/bin
for the directory where the nmap binary is installed.
After changing the file, be sure to open a new shell session, or type exec bash
to refresh it.
You also have to make sure, that it has execute permission (chmod +x <file>
).
When you execute:
nmap --version
You should see something like this:
Nmap version 6.46 ( http://nmap.org )
Platform: i686-pc-linux-gnu
Compiled with: liblua-5.2.3 openssl-1.0.1g libpcre-8.34 libpcap-1.5.3 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select
If you do, nmap
is installed and in your $PATH
.