簡體   English   中英

無法導入PIL.Image

[英]Could not import PIL.Image

當我想使用train_generator.next()方法進行深度學習項目時,我發現了錯誤信息:

'Could not import `PIL.Image`. The use of `array_to_img` requires PIL.'

但是我已經寫了從PIL導入圖像X,y = train_generator.next()導入PIL的代碼

我該如何解決這個問題? 非常感謝你!

通過pip或通過系統軟件包管理器安裝PIL(在某些情況下,pip的PIL不起作用)

PIP: pip install Pillow

Ubuntu(apt): sudo apt-get install python-PIL

您需要使用以下方法安裝枕頭:

pip install Pillow

並使用:

from PIL import Image

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM