You can go overland to Vietnam by train or road from Nanning.
There is a consulate in Nanning so you can pick up a visa there. Tickets for these trips are on sale in Yangshuo.
There is a train from Nanning to Kunming through impressive mountain scenery.