pythonpython-3.xcommand-line-argumentsshodan

How to run a python script from linux terminal when it imports libraries like shodan?


root@kali:~# ./collecting_info_using_facets.py apache 
Traceback (most recent call last):
  File "./collecting_info_using_facets.py", line 3, in <module>
    import shodan
ImportError: No module named shodan

I included path as #!usr/bin/env python but then also I cannot import shodan from the command line but I can run the same program from python3 IDLE.


Solution

  • It's because you need to download the Python module called 'Shodan'. You don't seem to have it installed, that's why Python is returning the error: ImportError: No module named shodan

    You can install Shodan for Python3 via:

    pip3 install shodan
    

    Or if you're running Python2, try:

    pip2.7 install shodan
    

    Best of luck.