You typically have to use the web2py shell: python web2py.py -S appname -M
If you are trying to use gluon libraries by themselves in some other application (without using web2py at all), then you either need to put web2py on your PYTHONPATH or copy the needed libraries where you want to use them.