The first time I visited London I spent a weekend there by myself. I had a great time, and felt very safe.
I stayed at Bayswater, which has a lot of hostels and cheap hotels, and is within walking distance of Portobello Road (well, it's also within walking distance of, say, Oxford Street, if you like to walk...)
The tube is safe, or at least I felt safe (I was 21 at the time, and a woman), at all hours.
During the day there are hoardes of tourists everywhere. My advice is to try to look less like a tourist at night--walk determinedly, and without a map in hand. It could be that I am overcautious, but I never felt threatened one bit.
In general, don't look too much like a tourist (and keep that camera off your neck), they're the easy target everywhere, don't feel scared, and enjoy yourself!
I had so much fun walking around, taking the tube to random places (I had a weekend tube-pass) and seeing what was there. I also tried to get "lost" on my second day, but unfortunately I didn't quite manage (I seem to remember I was around Camden or Covent Garden), as one gets used to the streets/street names quite quickly...