If a beginner tries PyQt to try GUI with python I got caught from the beginning, so I will leave it as a memorandum.
As we will see later, this error is due to Anaconda, so I think that it will be a solution when the environment is built other than that and an import error occurs.
Windows 8.1 Anaconda 4.3.8 python 3.5.2 PyQt5 5.8
I created a python3.5.2 environment with Anaconda and installed PyQt5 there.
For the installation procedure GUI programming with PyQt5 and python3 [0] I referred to.
Installation procedure At the last startup confirmation import PyQt5.QtWidgets Where I typed in "The specified module cannot be found."
On the other hand simply import PyQt5 If you just type And no error occurs.
The following site for the cause PyQt5 cannot be used in Python environment introduced from Anaconda3 according to
QtWidgets refers to "python3.dll" which does not exist when the environment is built with Anaconda. It seems that it is spitting out an error because this is not found.
Also PyQt5 cannot be used in Python environment introduced from Anaconda3 The remedy is listed in.
At the command prompt anaconda search -t conda pyqt5 Enter (The red one on the screen is just hiding the user name. Don't worry because (py352) is just activating the virtual environment in Anaconda.)
The next command to enter depends on your environment, but this time my environment is win-64
bpentz/pyqt5 Is used.
anaconda show bpentz/pyqt5 When you enter the command
The next command to enter is displayed (in the area surrounded by the red frame at the bottom of the image). It's long, so it's easy to copy and paste.
Command instructed conda install --channel https://conda.anaconda.org/bpentz pyqt5 When you enter
In the middle You will be asked Proceed ([y] / n) ?, so just enter y.
That's it.
I was able to import it safely.
I finally got to the starting point. Recently, I think Anaconda is kind to beginners, but strict to beginners.
Recommended Posts