在cmd界面安装
C:\Users\li>pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pillow in c:\users\li\appdata\local\programs\python\python311\lib\site-packages (9.3.0)
from PIL import Image
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
# 👇️ Before installing Pillow, uninstall PIL.
pip uninstall PIL
# 👇️ in a virtual environment or using Python 2
pip install Pillow
# 👇️ for python 3 (could also be pip3.10 depending on your version)
pip3 install Pillow
# 👇️ for python 3 (could also be pip3.10 depending on your version)
python3 -m pip install --upgrade Pillow
# 👇️ using py alias (Windows)
py -m pip install --upgrade Pillow