[PYTHON] About import error of PyQt5.QtWidgets (Anaconda)

preface

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.

environment

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.

error

Installation procedure At the last startup confirmation import PyQt5.QtWidgets Where I typed in s001.JPG "The specified module cannot be found."

On the other hand simply import PyQt5 If you just type s004.JPG And no error occurs.

Cause

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.

solution

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 s002_1.jpg (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

s002_2.jpg

bpentz/pyqt5  Is used.

anaconda show bpentz/pyqt5 When you enter the command

s003_1.jpg 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

s003_2.jpg

In the middle You will be asked Proceed ([y] / n) ?, so just enter y.

That's it.

result

s006.JPG

I was able to import it safely.

Impressions

I finally got to the starting point. Recently, I think Anaconda is kind to beginners, but strict to beginners.

Recommended Posts

About import error of PyQt5.QtWidgets (Anaconda)
About import error of numpy and scipy in anaconda
About import
About import
Installation of Anaconda3
scikit-learn import error
About all of numpy
About tweepy error handling
About MultiIndex of pandas
About the uncluttered arrangement in the import order of flake8
About variable of chainer
Personal notes about the integration of vscode and anaconda
About max_iter of LogisticRegression () of scikit-learn
About FastAPI ~ Endpoint error handling ~
About Japanese path of pyminizip
About the ease of Python
About Japanese support of cometchat
Various import methods of Mnist
About various encodings of Python 3
ROS Python-Own service import error
About all of numpy (2nd)
Version upgrade of python Anaconda
About approximate fractions of pi
About the components of Luigi
About HOG output of Scikit-Image
About the features of Python
About data management of anvil-app-server
About the bug that anaconda fails to import numpy and scipy
Error in ordinal number when importing Numpy in Anaconda environment of Windows