Pingyao has no airport. The closest major city and by extension - airport, is Taiyuan. From Taiyuan it takes approximately two hours by train, bus, or even taxi, to Pingyao.
The train station in Pingyao is located about a 5-10 minute walk away from the West Gate of the Old Town. Pingyao is easily accessible from Beijing, Chengdu, Xian, Chongqing and Taiyuan. The trains from the south (e.g. Guangzhou) are making 2 minute stops in Pingyao. Check details for each train not to miss the station.
Buses run from Xi'an and takes 6 hours. Regular Minibuses leave Taiyuan for Pingyao for around 10 yuan up to 6 pm. and the bus ride is approximately 2 hours.