Search code examples
pythonpython-3.xbottle

ModuleNotFoundError: No module named 'bottle'


Here is the issue i am running in:

I have installed using anaconda and later with pip: conda install -c conda-forge bottle

When i run my code in spyder:

from bottle import run, post


@post('/')  
def main():  
    return 


if __name__ == '__main__':  
    run(host='localhost', port=8080, debug=True)

I get this:

Bottle v0.12.18 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

But when i try to run python bot.py in command i get:

Traceback (most recent call last):
  File "bot.py", line 1, in <module>
    from bottle import run, post
ModuleNotFoundError: No module named 'bottle'

Why is it showing me this error since bottle is clearly installed?


Solution

  • I would recommend installing pip first and then running the command

    pip install bottle
    

    in your shell.