High-risk papillomavirus (HPV) is one of the major reasons for cervical cancer, causing most lethal gynecologic malignancies worldwide. For cervical cancer progression, oncogene E7 plays vital roles and is used as one of the major targets for cervical tumor diagnosis and treatment. In the clinic, successful treatment of cervical cancer relies on diagnosing the disease at an early stage, where a late-stage diagnosis usually led to treatment failure. In this work, we designed and purified an HPV18 E7 oncogene targeting affibody, named as ZHPV18E7, for in vitro and in vivo imaging and targeted treatment of cervical cancer. In vitro, ZHPV18E7 showed a specific targeting effect against an HPV18 positive cell line; as a contrast, the affibody did not target the HPV18 negative cell line. In vivo, we tested the bio-distribution of the affibody in mice bearing cervical cancer. The whole animal imaging analysis indicated the affibody-targeted tumor tissue specifically with 10 min after injection, and the affibody reached the highest level at tumor tissues 45 min after injection. At the 24th hour after injection, the affibody still maintained a certain level in tumor tissues compared to other organs. To test the therapeutic effect of this affibody, we modified the affibody (i.e., ZHPV18E7) with a clinically used anti-cancer agent (i.e., Pseudomonas exotoxin). In a mice cervical cancer model, ZHPV18E7 was able to deliver Pseudomonas exotoxin to tumor tissues effectively, showing great potential for cancer treatment. This study indicated that ZHPV18E7 could be employed for in vitro imaging and targeted treatment of cervical cancer. Beyond the chemotherapeutic agent used in this work, the affibody could be extended for carrying other therapeutic agents for cervical cancer treatment.