I have installed GDAL and checked on the command line, it is working and when I run the gdal2tiles.py on the command line it works but when I run the same file gdal2tiles.py with python IDLE, I get "No module named 'osgeo'" error. Can you assist.
This sounds like you have multiple python installations, and GDAL is installed on one and not the other.
Try the following (which I have based upon this). Create a text file within your python installation site packages folder
usrlocal.pth. In this text file insert one line giving the path to your second python installation site packages folder which features the GDAL install, for example:
Got the same problem. I fixed ir by installing python-gdal using synaptic with my Debian Jessie