![](/img/trans.png)
[英]AttributeError: module 'PIL.Image' has no attribute 'Resampling'
[英]module 'PIL.Image' has no attribute 'load'
image = Image.load(img)
這一行給了我錯誤。 我正在嘗試加載圖像。
AttributeError: module 'PIL.Image' has no attribute 'load'
改為這樣做:
from PIL import Image
image = Image.open("path_to_image.png")
將“path_to_image”替換為您的實際路徑。
請閱讀文檔: https : //pillow.readthedocs.io/en/stable/handbook/tutorial.html
img = Image.open("path/to/image")
img.load()
.load
方法不是必需的,因為 Image 類在第一次訪問時會自動加載打開的圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.