running python from command line: application failed to start because it could not find or load the Qt platform plugin "windows"

This may be a simple question for many of you but I need a bit of help. I have been having problems when running matplotlib from command line in windows 10. I get this error: This application failed to start because it could not find or load the Qt platform plugin "windows" in "". I recently updated and perhaps installed something which changed and it no longer works when it did previously. Matplotlib also works fine if I run from spyder, but what I want to be doing is actually launching a gui made with PyQt5 which used to work fine but gives the above error as I am calling matplotlib, if I run a script just with matplotlib I get the same error but I also get the same error when calling a simple pyqt example from https://github.com/baoboa/pyqt5/tree/master/examples which used to work just fine also. When I try and run the qt gui from spyder nothing happens and the kernel is restarted. I can run just the gui design from spyder and it is displayed correctly but I get the same error when running from windows command processor as above.

I have found from this previous post Error "could not find or load the Qt platform plugin windows" while using matplotlib in pycharm that it is suggested to set QT_PLUGIN_PATH to C:\ProgramData\Anaconda3\Library\plugins However I don't have QT_PLUGIN_PATH as an option. If I create new variable and add the path to the plugins it doesn't help. In the plugins/platforms there is qwindows, qoffscreen and qminimal.dll I am confused as to why when running from the command line by python main.py I get the above error and also when running from spyder the gui doesn't appear. I am generally just lost here...

Thanks for any help Sorry, I am also running python 3.6. I recently updated for the new spyder release. My matplotlib is 2.1.0 and PyQt5 version 5.6.0