PYTHON使用PIL打开图片时程序会暂停运行,如何让程序在打开图片仍能继续运行?

如下代码,在PC下运行打开图片后程序就会暂停(貌似在MAC下运行就不会暂停)
。只有关闭了图片程序才会继续运行。请问如何能在显示图片的同时继续运行程序?

from PIL import Image

im = Image.open("xxx.jpeg")
im.show()
import threading
from PIL import Image

picture_path = r’xxx.jpeg‘

def open_pic():
    img = Image.open(picture_path)
    img.show()
    return

if __name__ == '__main__':
    t = threading.Thread(target=part2)  # 创建线程
    t.setDaemon(True)   # 设置为后台线程,这里默认是False,设置为True之后则主线程不用等待子线程
    t.start()
    print('testing testing testing')

简单的办法就是 开一个线程用于显示图片