小编R.Y*_*ang的帖子

Tifffile.imshow() KeyError: 'matplotlib.pyplot'

我在 Python 3.5.2 中使用了 Tifffile 模块的 imshow() 方法来显示 tiff 图像。

代码如下:

import tifffile as tiff

IM_ID = '6120_2_2'
im_rgb = tiff.imread('/home/roy/image&csv/image/{}.tif'.format(IM_ID)).transpose([1, 2, 0])
im_size = im_rgb.shape[:2]
tiff.imshow(im_rgb)
Run Code Online (Sandbox Code Playgroud)

但是有一个错误:

Traceback (most recent call last):
  File "/home/roy/PycharmProjects/CSV2Ploy/csv2ploy.py", line 49, in <module>
    tiff.imshow(im_rgb)
  File "/usr/local/lib/python3.5/dist-packages/tifffile/tifffile.py", line 6349, in imshow
    pyplot = sys.modules['matplotlib.pyplot']
KeyError: 'matplotlib.pyplot'
Run Code Online (Sandbox Code Playgroud)

我想一定是我的开发环境缺少matplotlib.pyplot模块。于是查了一下matplotlib目录,发现目录里确实有pyplot.py文件。

终端查询pyplot.py文件

我网上了很多资料,但是大部分都是import matplotlib.pyplot的问题,有人能帮我解决这个问题吗?

python tiff matplotlib python-3.x

5
推荐指数
0
解决办法
1301
查看次数

标签 统计

matplotlib ×1

python ×1

python-3.x ×1

tiff ×1