Abstract: The invention provides an indolizine compound represented by formula I or a pharmaceutically acceptable salt thereof, a preparation method and a use thereof. The indolizine compound has an inhibitory effect on wild-type and/or mutant EZH2 or EZH1, and is expected to be developed into a novel drug for anti-tumor or for the treatment of autoimmune diseases.