Nick
Nick

Reputation: 1934

Raspberry Pi: No module named nmap

I'm trying to install nmap for my pi, and I did this:

sudo apt-get install nmap

Which seemed to work just fine. But when I open a session of python and try to import nmap:

>>> import nmap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named nmap

Which is super weird, because I installed it fine, or at least I thought. Any ideas why this might be happening?

Upvotes: 1

Views: 6669

Answers (4)

Bahaa Attia
Bahaa Attia

Reputation: 1

for using nmap with python3 u have to download it from here. Then extract it and from the terminal run the following commands:

python setup.py install 
open python3 
import nmap 
from nmap import*

Upvotes: 0

Bahaa Attia
Bahaa Attia

Reputation: 1

if you run python2 its will work import nmap form nmap import* but if u running python3 it's not gonna work

Upvotes: 0

mikeb
mikeb

Reputation: 11267

You can sudo apt-get install python-nmap for the same thing

Or you need to get the Python NMap bindings from here

Upvotes: 2

Dan Getz
Dan Getz

Reputation: 9137

If you run

apt-cache show nmap

you'll see in the information about it that it's not a Python package. If you want, you can run man nmap to learn more about what you've installed, so far.

The Python package you want to install is probably named something like python-nmap or python3-nmap. You can run

apt-cache search nmap

to list all packages with "nmap" in the name, and see what its name really is, and then something like

sudo apt-get install python-nmap

to install.

Upvotes: 5

Related Questions