Du Wei was from Fu County (涪縣), Zitong Commandery (梓潼郡), which is in present-day Mianyang, Sichuan. He was born sometime in the mid- or late Eastern Han dynasty. In his younger days, he studied under the tutelage of Ren An (任安; 124–202), a famous scholar and polymath. Liu Zhang, the Governor of Yi Province (covering present-day Sichuan and Chongqing), heard about Du Wei and offered him the position of an Assistant Officer (從事) in the provincial government. However, Du Wei claimed that he was ill and declined the offer. In 214, after the warlord Liu Bei seized control of Yi Province from Liu Zhang, he wanted to recruit Du Wei to serve in his administration. Du Wei claimed that he could not serve because he was deaf, and stayed at home.