web-dev-qa-db-ja.com

LinuxにPyQt5 5.14.1をインストールする

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/

次に、Zipフォルダーを https://www.riverbankcomputing.com/software/pyqt/download5 からダウンロードして実行します。

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

成功した

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

だから私はインストールしました

pip3 install PyQt5.sip
pip3 install sip

成功した

それでも同じエラーが発生するNo module named 'PyQt5.sip' ために import PyQt5.QtCore

pyQtChartも試しましたが、まだエラーです

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/

https://www.riverbankcomputing.com/software/pyqtchart/download からZipフォルダーもダウンロードして実行します。

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.

QTスクリーンショット:: enter image description here

私の最終目標は、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)

それでも同じエラーが発生する:

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

DebianまたはUbuntu LinuxディストリビューションにPyQt5をインストールするのが非常に難しい場合があります。 Debian 10バスター(安定版)を実行しているシステムにpython3用にインストールできました。
aptパッケージマネージャーを使用してインストールしました。

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