Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why wont this work?
#1
Microsoft Windows [Version 10.0.17134.648]
(c) 2018 Microsoft Corporation. All rights reserved.

(venv) C:\Users\Mario\PycharmProjects\New Project 1>pip3 install nmap
Requirement already satisfied: nmap in c:\users\mario\pycharmprojects\new project 1\venv\lib\site-packages (0.0.1)
You are using pip version 10.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I'm trying to use nmap in a python script. When I try to install it, it says that I already have nmap installed... So it should work in my python script right? But it's not working. I get this error when I try to use nmap in a script:

(I have "import nmap" at the top of the script)

"C:\Users\Mario\PycharmProjects\New Project 1\venv\Scripts\python.exe" "C:/Users/Mario/PycharmProjects/New Project 1/script.py"
Traceback (most recent call last):
  File "C:/Users/Mario/PycharmProjects/New Project 1/script.py", line 3, in <module>
    ns = nmap.PortScanner()
AttributeError: module 'nmap' has no attribute 'PortScanner'

Process finished with exit code 1
Reply
#2
It works in terminal but doesnt work in pycharm?... How do I get it to work in PyCharm?
Reply
#3
(Mar-29-2019, 01:30 AM)ejected Wrote: It works in terminal but doesnt work in pycharm?... How do I get it to work in PyCharm?
You choose the same Python interpreter as in terminal.
So from cmd:
C:\>python -V
Python 3.7.2

C:\>pip -V
pip 19.0.3 from c:\python37\lib\site-packages\pip (python 3.7)
So in this case i would Configure a Python interpreter to be pointing to Python 3.7.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why wont this path work one way, but will the other way? cubangt 2 623 Sep-01-2023, 04:14 PM
Last Post: cubangt
  Why wont subprocess call work? steve_shambles 3 2,605 Apr-28-2020, 03:06 PM
Last Post: steve_shambles
  When I import a Module it wont run PyNovice 17 6,246 Oct-26-2019, 11:14 AM
Last Post: PyNovice
  wont print last sentence.. mitmit293 2 2,324 Jan-27-2019, 05:38 PM
Last Post: aakashjha001
  Why wont this work :( Nonagon 2 2,970 Nov-03-2018, 03:38 AM
Last Post: wavic
  Boolean Wont Work fierygaming 5 4,142 Jun-13-2018, 07:49 PM
Last Post: fierygaming
  Reddit Bot comes up with no errors but wont actually run Rubix3D 0 2,589 Jan-12-2018, 12:53 AM
Last Post: Rubix3D

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020