Search code examples
python-2.7importerrorcherrypy

ImportError when I try to run a .py script using CherryPy


I'm using python 2.7 and cherrypy 3.7, and am running them on Ubuntu 14.04.

I have a simple hello world file that I am trying to run with the command:

python HelloWorld.py

This results in the following error:

ImportError: No module named cherrypy

Please explain why Python couldn't find the module.


Solution

  • Ubuntu is going to have a native version of python 2.6 for instance. So you'll need the full path to your python file. Try to run this and if it fails search your system for a python2.7 folder.

    /usr/local/bin/python2.7 tut01.py
    

    Hope this helps!