I put on the server (centos 6) in a virtual environment (virtualenv) PyQt5: pip install pyqt5 . Trying to write something using it. On the very first line from PyQt5.Qt import Qt an ImportError: cannot import name 'Qt' error ImportError: cannot import name 'Qt' . I just call python generate.py (third python of course). What could be the problem?
|
1 answer
In order not to bother with CentOS with the compilation of the libraries necessary for Qt to work, you can conda install pyqt .
An example that puts a miniconda assembly into a centos: 6 docker container creates a separate environment (pyqt5) and puts the pyqt package into it (the default version):
$ docker run -it --rm centos:6 # mkdir miniconda && cd miniconda # curl -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh # bash Miniconda3-latest-Linux-x86_64.sh -b # export PATH="/root/miniconda3/bin:$PATH" # python -V # -> Python 3.6 # conda create -n pyqt5 # conda install -n pyqt5 pyqt # source activate pyqt5 # python -c 'from PyQt5.Qt import Qt' - I have never worked with a conda. How does he even differ from virtualenv? And why do you think that he will be better? And I’m generally afraid of the docker as a fire ... I’m probably not going to risk contacting him. Too hard. - PECHAIR
- @DarkByte: 1-
dockerI used to demonstrate behavior on a pure CentOS system (you indicated in the question that you have a server on CentOS). If you do not need a docker, you can not use it. 2- conda allows you to isolate packages written in different languages (in the case of Qt, this is C ++), and not only on pure Python as in the case of virtualenv (in this case, you have to install Qt yourself). Installing packages is a task with many dimensions, so almost all cases are extreme, everything is on the border. In different cases, a variety of options can be. I showed one of the workers - jfs
|
from PyQt5.QtCore import Qt- prusanov