Python3.9 does not have its own graphics processing library and
needs to install the library Pillow
pip install Pillow
In order to use the following command
from PIL import Image
There are several versions of python in the system. The
default setting command python is 2.7 and python3 is 3.9 to
upgrade the specified version. The
first step is to upgrade pip and
pip is frequently upgraded.
python3 -m pip install --upgrade pip
Install the library using pip
python2 -m pip install ***
python3 -m pip install ***
Do not install pillow from domestic sources by default
python3 -m pip install pillow
Use domestic sources to install pillow
python3 -m pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/
Domestic source selection
(1)阿里云 http://mirrors.aliyun.com/pypi/simple/
(2)豆瓣http://pypi.douban.com/simple/
(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
(5)华中科技大学http://pypi.hustunique.com/
View installation list
Default python
pip list
Specify python version to view
python3 -m pip list
Up to the current Pillow version
Pillow 8.1.2
At first, I thought there was a PIL library, but I
found that there was none.
Below is an example of the error.
[dalaojun@localhost python语言程序设计13期]$ python3 -m pip install PIL
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement PIL
ERROR: No matching distribution found for PIL