web-dev-qa-db-fra.com

Installez PyQt5 5.14.1 sur Linux

pip3 install PyQt5
Collecting PyQt5
  Using cached https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz
    Complete output from command python setup.py Egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-b2zw891b/PyQt5/setup.py'

    ----------------------------------------
Command "python setup.py Egg_info" failed with error code 1 in /tmp/pip-build-b2zw891b/PyQt5/

Ensuite, j'ai téléchargé le dossier Zip de https://www.riverbankcomputing.com/software/pyqt/download5 et exécutez:

python3 configure.py --qmake /home/oo/Qt/5.14.0/gcc_64/bin/qmake
make
Sudo make install

Réussi

>>> import PyQt5
>>> import PyQt5.QtCore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
>>> 

Alors j'ai installé

pip3 install PyQt5.sip
pip3 install sip

Réussi

mais toujours la même erreur No module named 'PyQt5.sip' pour import PyQt5.QtCore

a également essayé PyQtChart mais toujours une erreur

pip3 install PyQtChart
Collecting PyQtChart
  Using cached https://files.pythonhosted.org/packages/83/35/4f6328db9a31e2776cdcd82ef7688994c11e265649f503858f1913444ba9/PyQtChart-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting PyQt5>=5.14 (from PyQtChart)
  Using cached https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz
    Complete output from command python setup.py Egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-gzep4mr7/PyQt5/setup.py'

----------------------------------------
Command "python setup.py Egg_info" failed with error code 1 in /tmp/pip-build-gzep4mr7/PyQt5/

J'ai également téléchargé le dossier Zip de https://www.riverbankcomputing.com/software/pyqtchart/download et j'ai exécuté:

python3 configure.py --qmake /home/oo/Qt/5.14.0/gcc_64/bin/qmake
Error: Unable to import PyQt5.QtCore. Make sure PyQt5 is installed.

Capture d'écran QT :: enter image description here

Mon objectif final est d'exécuter un graphique en chandeliers en utilisant pyqt5.

Sudo python3 -m pip install pyqt5 pyqtchart
[Sudo] password for oo:  
The directory '/home/oo/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with Sudo, you may want Sudo's -H flag.
The directory '/home/oo/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with Sudo, you may want Sudo's -H flag.
Requirement already satisfied: pyqt5 in /usr/lib/python3/dist-packages
Requirement already satisfied: pyqtchart in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: PyQt5-sip<13,>=12.7 in /home/oo/.local/lib/python3.6/site-packages (from pyqtchart)

mais toujours la même erreur:

Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>> import PyQt5.QtCore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
>>> 
12
anoop

Parfois, il est très difficile d'installer PyQt5 sur la distribution Debian ou Ubuntu Linux. J'ai pu l'installer pour python3 sur mon système exécutant Debian 10 buster (stable).
Je l'ai installé avec le gestionnaire de paquets apt.

Sudo apt-get update 
Sudo apt-get install python3-pyqt5
0
Ruby