Could not find or load the Qt platforms plugin

Hello everyone,
I’ve met some trouble when I run the code

    import matplotlib.pyplot as plt
    import numpy as np

    # functions to show an image

    def imshow(img):
        img = img / 2 + 0.5  # unnormalize
        npimg = img.numpy()
        plt.imshow(np.transpose(npimg, (1, 2, 0)))

    # get some random training images
    dataiter = iter(trainloader)
    images, labels =

    # show images
    # print labels
    print(' '.join('%5s' % classes[labels[j]] for j in range(4)))

the program fails and report that

this application fail to start because it could not find or load the Qt platforms plugin "windows" in "".

I am using:

OS: windows 10
python: 3.6.4 in anaconda

I have added D:\Anaconda3\Library\plugins\platforms into system variables but it does not work.

Hope someone can help me

1 Like