nmap nmap PortScannerError nmap program was not found in path

–1 vote

I am facing some error while using python-nmap:

I am running the following:

import nmap
nm = nmap.PortScanner()

I am getting this error:

Traceback (most recent call last):   File "a.py", line 2, in <module>     nm = nmap.PortScanner()   File "/home/edureka/.local/lib/python2.7/site-packages/nmap/nmap.py", line 131, in __init__     os.getenv('PATH') nmap.nmap.PortScannerError: 'nmap program was not found in path. PATH is : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin'
Jan 30, 2019 in Python by Sulith
14,485 views

1 answer to this question.

0 votes

python-nmap module used in python happens to use nmap binary installed in the system. The error you are getting is because python can't find the depending nmap.  Installing nmap should solve this. To install nmap, run the following command:

sudo apt-get install nmap 
answered Jan 30, 2019 by Omkar
• 69,210 points
what about windows

You can download nmap software for windows. Use the below given link to download nmap.

https://nmap.org/dist/nmap-7.80-setup.exe

After installing nmap in your system, go to C:\Program Files (x86)\Nmap> folder. Now you can able to scan your IP.

both of your answer is not working

please suggest some other way

sorry for my comment but whatever you have type in your comment its work after closing all studio or code and reopening it

Thanks for that help other people try above method which is in above comment and close your idea,code, or android studio or whatever you are using and close you file and make new file and reopen you application and it will work

Hello, @Pankaj,

You can follow this:

Here are the steps to install Nmap on Windows:

1. Browse to https://nmap.org/download.html and download the latest self-installer

        Run the downloaded .exe file. In the window that opens, accept the license terms

2. Choose the components to install. By default, the Zenmap GUI will be installed

3. Select the install location and click Install

4The installation should be completed in a couple of minutes.

Related Questions In Python

0 votes
1 answer

Section postgresql not found in the database.ini file

Python doesn't know what $FILEDIR is. Try an absolute path ...READ MORE

answered Oct 3, 2018 in Python by Priyaj
• 58,090 points
3,189 views
0 votes
1 answer

Installing package not found in conda

You can install pip in your conda env and then run pip ...READ MORE

answered Jul 31, 2019 in Python by SDeb
• 13,300 points
3,362 views
0 votes
1 answer

Error: "Module not found" while importing tensorflow in pycharm.

Try the following: Go to Files -> Settings ...READ MORE

answered Jun 23, 2020 in Python by Sirajul
• 59,230 points
2,071 views
0 votes
1 answer

KeyError: "['Place'] not found in axis"

Hi@akhtar, You need to provide the axis parameter ...READ MORE

answered Jun 24, 2020 in Python by MD
• 95,440 points
39,946 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,023 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,409 views
+1 vote
3 answers
0 votes
1 answer

How to print a message or the error if a file is not found?

To print the message that file is not ...READ MORE

answered Jan 2, 2019 in Python by Omkar
• 69,210 points
2,362 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP