I don't know how diligent each and every consulate is in enforcing this rule but in principle you should not be able to do that. Here is article 6 of the Schengen Visa Code:
Consular territorial competence
- An application shall be examined and decided on by the consulate of the competent Member State in whose jurisdiction the applicant legally resides.
- A consulate of the competent Member State shall examine and decide on an application lodged by a third-country national legally present but not residing in its jurisdiction, if the applicant has provided justification for lodging the application at that consulate.
Point 2 provides a bit of leeway and point 1 could theoretically allow you to submit your application elsewhere and have it forwarded to the proper consulate but I am not aware of any Schengen countries offering this. To the best of my knowledge, you must generally be a resident in the UK to apply to one of the consulates there.
Also note that visa applications for virtually all Schengen countries in London are handled by third-party outsourcing companies like VFS Global or TLS Contact. As a regular tourist, your application won't even reach the relevant consulate.
I haven't check them all but the websites from the embassies of France, Germany, Italy, Spain or Poland all contain language to that effect.