首页 > 编程语言 >Python安装PIL报错:No module named 'PIL'的解决方法

Python安装PIL报错:No module named 'PIL'的解决方法

时间:2022-09-25 11:34:16浏览次数:56  
标签:named PIL No Python module 报错 pillow

在Python中,如果import了PIL,但是本机上并没有安装相应的组件,在运行py程序时会报错:ModuleNotFoundError: No module named 'PIL'。

D:\Python\PY>MYPYAPP.py
Traceback (most recent call last):
  File "D:\Python\PY>MYPYAPP.py", line 17, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

  

出现上述问题时,我们简单的使用pip install PIL是无法解决问题的,正确的做法是使用pip install pillow:

D:\Python\PY>pip install pillow
Collecting pillow
  Downloading Pillow-9.2.0-cp38-cp38-win_amd64.whl (3.3 MB)
     ---------------------------------------- 3.3/3.3 MB 3.6 MB/s eta 0:00:00
Installing collected packages: pillow
Successfully installed pillow-9.2.0

  

标签:named,PIL,No,Python,module,报错,pillow
From: https://www.cnblogs.com/yangjisen/p/16727497.html

相关文章