Home > Software design >  Python Nmap module not found despite already being installed
Python Nmap module not found despite already being installed

Time:01-13

I am trying to write a port scanning program as part of my course assignment. However, even after downloading Nmap, an error appeared. It says 'nmap' is not accessed by pylance. I cannot access it interactive mode either. I am still very new to programming so any form of help will be much appreciated As you can see here Nmap is already downloaded. But... And...

I tried deleting and re-installing Nmap, that did not work. I searched YouTube for solutions, but a lot of the files and programs they had I did not. I have already downloaded nmap from the website too.

CodePudding user response:

Maybe that happened because you have many interpreter and you installing in another interpreter to fix that you need to change the interpreter you can see the documentation in https://code.visualstudio.com/docs/python/environments
or you can try using python venv by write this command in your terminal

python -m venv venv

after that activate the venv and activate the venv

.\venv\Scripts\activate

after you activate the venv you just need to install the nmap

pip install python-nmap

I hope this answer can solve your problem

CodePudding user response:

You might have multiple version of python installed. When you run py is opens up 3.10.7 for you. You need to make sure you installed python-nmap for that version.

Apart from using a virtual environment, a quick fix would be to try installing nmap using pip3

pip3 install python-nmap

This will install nmap for your python3 installation. However if you have multiple python3 installations, I would suggest using a virtual environment of the particular python version you want.

  • Related