Python Can';t使用PIL打开照片
我尝试使用PIL打开照片,但无法打开 我怎样才能完成它 这是我的代码和错误消息:Python Can';t使用PIL打开照片,python,image,python-imaging-library,Python,Image,Python Imaging Library,我尝试使用PIL打开照片,但无法打开 我怎样才能完成它 这是我的代码和错误消息: 从PIL导入图像 img=Image.open('test.png')) 文件“imagetest.py”,第3行,在 img=Image.open('test.png')) 文件“/anaconda3/lib/python3.7/site packages/PIL/Image.py”,第2687行,打开 %(如果文件名为fp,则为文件名) OSError:无法识别图像文件“test.png” 尝试提供映像的完整
从PIL导入图像
img=Image.open('test.png'))
文件“imagetest.py”,第3行,在
img=Image.open('test.png'))
文件“/anaconda3/lib/python3.7/site packages/PIL/Image.py”,第2687行,打开
%(如果文件名为fp,则为文件名)
OSError:无法识别图像文件“test.png”
尝试提供映像的完整路径。仅传递文件名(不传递完整路径)作为参数,仅当映像与脚本文件位于同一目录中时才有效。尝试将完整路径作为@AchthaiHalage-Antiented传递。我不认为文件不在同一目录中是问题所在,听起来图像可能已损坏,您可以上载图像以验证它吗?
File "imagetest.py", line 3, in <module>
img = Image.open('test.png')
File "/anaconda3/lib/python3.7/site-packages/PIL/Image.py", line 2687, in open
% (filename if filename else fp))
OSError: cannot identify image file 'test.png'