windows下按照PIL,提示一下錯誤:
錯誤原因:
1.后來找了很多方法,發現我的電腦是64位的,而官網只提供32位的,就是自己去官網下載的其他PIL
2.沒有對應的版本,我python 3.6.0
下載官網提供的.whl文件
地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
里面有很多包,頁面查找Pillow,下載對應python版本的文件。
如我的是python 3.6.0,則下載Pillow‑3.4.2‑cp36‑cp36m‑win_amd64.whl
安裝.whl文件
在.whl文件目錄下運行cmd命令
pip install Pillow-3.4.2-cp36-cp36m-win_amd64.whl
安裝成功
引用PIL
官網也說了“a replacement for PIL, the Python Image Library, which provides image processing functionality and supports many file formats.
Use from PIL import Image
instead of import Image
.”
Python圖像包,引用由原來的import Image
改為from PIL import Image
。