from pylab import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import random
import time
from scipy.misc import imread
from scipy.misc import imresize
import matplotlib.image as mpimg
import os
# General setup
matplotlib
#gray()
# 2D Array
a = array([[4,5,6], [1,2,3]])
# shape of matrix in format n x m
a.shape
# Read in an image
i = imread('test.jpg')
if __name__ == "__main__":
imshow(i) # HANGS ON OSX
plt.show()
这个代码在我的Windows机器上运行完全正常,但是在MacOSX上,只要我调用imshow它就会挂起(即使在一个简单的数组上),图像窗口会弹出但它会挂起。我正在使用pycharm。
有人知道这是为什么吗?我做错了吗?