I am working on a pyqt5
project in Ubuntu16.04
. To install pyqt5
, I used the command sudo apt-get install python3-pyqt5
. In Ubuntu16.04
, python3.5
comes preinstalled so initially I designed everything with python3.5
. Application was running fine.
Later I upgrade the python3.5
to python3.6
using below steps:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
After the installation, I made sure that running python3
is invoking the python3.6
and not python3.5
:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --config python3
After this if I type in python3, it launches python3.6
.
Then I reinstalled all the python packages I required using sudo pip3 install <name>
(this time it was getting installed in python3 (python3.6). After this when I ran my application, it started giving me below error:
Traceback (most recent call last):
File "app.py", line 12, in <module>
from PyQt5 import QtGui, QtCore, QtWidgets, QtPrintSupport
ImportError: cannot import name 'QtGui'
With python3.5 it was working perfectly fine but with python3.6 it started showing this error. How can I resolve this issue. Thanks
I think the I went into this issue because I upgraded the python3 from 3.5 to 3.6 so I believe some path got messed up and it wasn't able to locate the pyqt5 properly.
I installed pyqt5
using apt-get install python3-pyqt5
. So I installed it using pip:
pip3 install pyqt5==5.14.0
and it worked fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.