The standard ways are:
a hub dynamo (ridiculously expensive considering I had one on my bike in the 1960s) but this needs a wheel rebuild as well as the purchase of the hub.
a bottle dynamo (which is a pain to get to rub against the tyre when you want it to and not when you don't). Also noisy and perhaps not very efficient.
There was a dynamo a while back which fitted to the frame just in front of the rear wheel and contacted the tread of the tyre instead of the side wall but I haven't seen this around for a while. Cant locate it via Google after a quick search.
I did wonder if there was another way. For example using a disc brake like assembly, with a metal plate rotating through two fixed contacts (just like a disc brake and pads).
For another example, having a light metal cover on the front wheel (like the aero wheels on time trial bikes) and fixed contacts all the way up the front forks.
Both (badly described) methods should provide the basic rotating split ring and metal brushes of a DC generator. I just have no idea how efficient this would be compared to a hub or bottle generator.
Of course, an adverse reaction to water and grit might play a part as well.
Just pondering.
Cheers
Dave R