1.依赖 pip install PythonMagick 2.转ico图标 import PythonMagick img = PythonMagick.Image(r"path\1.jpeg") # 这里要设置一下尺寸,不然会报ico尺寸异常错误 img.sample('32x32') img.write(r"path\1.ico")