我是python的新手,我正在尝试将.tif图像加载到以下代码中,以便稍后在各种x和y坐标处用点标记它。
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
image = mpimg.imread("mothTest.tif")
plt.imshow(image)
plt.show()
并产生以下错误:
File "<ipython-input-1-69a4ce2424d3>", line 1, in <module>
runfile('Z:/04PROJECTS Internal/GEMultiplexerProject/Method/StatisticalMethods/Cell Arangement APP/Python App/Centroid_LUT.py', wdir='Z:/04PROJECTS Internal/GEMultiplexerProject/Method/StatisticalMethods/Cell Arangement APP/Python App')
File "C:\Users\Michaela\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\Michaela\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "Z:/04PROJECTS Internal/GEMultiplexerProject/Method/StatisticalMethods/Cell Arangement APP/Python App/Centroid_LUT.py", line 29, in <module>
image = mpimg.imread("mothTest.tif")
File "C:\Users\Michaela\Anaconda2\lib\site-packages\matplotlib\image.py", line 1278, in imread
im = pilread(fname)
File "C:\Users\Michaela\Anaconda2\lib\site-packages\matplotlib\image.py", line 1256, in pilread
with Image.open(fname) as image:
File "C:\Users\Michaela\Anaconda2\lib\site-packages\PIL\Image.py", line 512, in __getattr__
raise AttributeError(name)
AttributeError: __exit__
有没有人碰巧知道如何解决这个问题?任何帮助将不胜感激!