from docx.enum.text import WD_PARAGRAPH_ALIGNMENT from docx import Document w=Document(r'文件路径') picture=w.paragraphs[1].add_run().add_picture(r'') w.paragraphs[1].alignment=WD_PARAGRAPH_ALIGNMENT.CENTER #中间对齐 w.save(r'') #对齐方式 LEFT,RIGHT,CENTER,JUSTIFY(两端对齐),DISTRIBUTE(分散对齐)