无法在Gitlab CI中使用pip3安装python3 PyQt5模块

露西工人自助餐

我属于Gitlab python3项目的一部分,在该项目中,由于文件.gitlab-ci.yml而导致我们尝试安装持续集成。

我正在尝试安装python3和我们需要的所有模块,以便执行python测试脚本。

我不完全知道为什么,但是我们不能使用sudo或apt-get。

感谢apk使用以下命令,我成功安装了python3:

- apk add python3 python3-dev

之后,由于以下命令,我升级了pip3:

- pip3 install --upgrade pip

我首先需要安装sqlalchemy,它运行良好:

- pip3 install sqlalchemy
    Collecting sqlalchemy
    Downloading SQLAlchemy-1.2.5.tar.gz (5.6MB)
    Installing collected packages: sqlalchemy
    Running setup.py install for sqlalchemy: started
    Running setup.py install for sqlalchemy: finished with status 'done'
    Successfully installed sqlalchemy-1.2.5

接下来,我尝试安装模块PyQt5,但似乎不可能,此命令不起作用:

- pip3 install PyQt5
    Collecting PyQt5
    Could not find a version that satisfies the requirement PyQt5 (from versions: )
    No matching distribution found for PyQt5

奇怪的是,当我执行以下命令时,PyQt5出现了:

- pip3 search pyqt5
    AnyQt (0.0.8)                     - PyQt4/PyQt5 compatibility   layer.
    tws-async (0.5.7)                 - Use the Interactive Brokers API (IBAPI) asynchonouslywith asyncio or PyQt5
    quartz-browser (2.1.0)            - Fast Lightweight web browser written in PyQt5
    pyqt5-macos-built (5.5.0)         - This package installs a prebuilt version of PyQt5 for Mac OS
    cheesemaker (0.3.8)               - A minimalistic image viewer using Python3 and PyQt5
    fgmk (0.7.3)                      - A PyQt5 Maker to generate a RPG Javascript game.
    pytc-gui (1.2.2)                  - PyQt5 GUI for pytc API
    hackedit (1.0a2)                  - The hackable IDE, built with Python3, PyQt5 and pyQode
    python-pyqt5-hexview (0.4.3)      - PyQt5 hex viewer widget.
    pyqt5-installer (5.7.0)           - This package installs an script to install PyQt5
    logReader (0.7.6)                 - PyQt5 programm for parse and reading any log file.
    Sonance-Music-Player (0.1.Alpha)  - This is a music player using PyQt5
    pyblish-qml (1.7.1)               - Frontend for Pyblish written in PyQt5/QML
    pynoder (1.0.3)                   - A Python and PyQt5 package for creating a node-based editor.
    pyqode.qt (2.10.0)                - Shim library that wraps PyQt5, PyQt4 and PySide
    python-pyqt5-vstructui (0.4.0)    - PyQt5 vstruct hex viewer widget.
    PyQt5 (5.10.1)                    - Python bindings for the Qt cross platform UI and application toolkit
    pyqt5-tools (5.9.0.1.2)           - Tools to supplement the official PyQt5 wheels
    PyQt5Designer (5.10.1)            - Python bindings for the Qt cross platform UI designer,must set windows PATH Environment like this:     PATH=D:\soft\Python35\Scripts\;D:\soft\Python35\;D:\soft\Python35\Lib\site-packages\PyQt5;....
    pyqt5reactor (0.0.1)              - 
    PyQt5Singleton (0.1)              - A simple singleton implementation to work with PyQt5
    pyqtspinner (0.1.1)               - A waiting spinner for PyQt5
    PyQtX (0.1.2)                     - Mimics the structure of PyQt5 but provides PyQt4 as a fallback solution.
    pyssb (0.1.1)                     - PyQT5 Site Specific Browser
    python-qt5 (0.3.0)                - PyQt5
    python-qdatamatrix (0.1.18)       - A PyQt4/PyQt5 widget for viewing and editing a DataMatrix object
    qroundprogressbar (1.0.0)         - PyQt5 port of C++ circular progress bar widget library
    Qt.py (1.1.0)                     - Python 2 & 3 compatibility wrapper around all Qt bindings - PySide, PySide2, PyQt4 and PyQt5.
    qt_backport (0.1.3)               - Makes PySide/PyQt4 code work with Qt5 (using PyQt5)
    QtPy (1.4.0)                      - Provides an abstraction layer on top of the various Qt bindings (PyQt5, PyQt4 and PySide) and additional custom QWidgets.
    QtStuff (0.4)                     - Compatibility layer and helper classes for PySide/PyQt4/PyQt5
    qutebrowser (1.2.1)               - A keyboard-driven, vim-like browser based on PyQt5.
    qutepart (3.1.1)                  - Code editor component for PyQt5
    SiQt (0.2.0a1)                    - A compatibility library for PyQt4, PyQt5 and PySide
    specguiutils (0.7)                - Library to provide PyQt5 widgets to display spec file information read using spec2nexus.spec file library
    TURP1210 (1.1.1)                  - A PyQt5 GUI framework for heavy vehicle diagnostic adapters using RP1210
    tv_viewer (1.1.3)                 - Python PyQt5 GUI to view tv program details using tvmaze API and SQLite
    vext.pyqt5 (0.5.21)               - Use system pyqt5 from a virtualenv
    world2d (0.2.0)                   - A widget for PyQt5 implementing a 2d world space to draw in.
    xcirculardichro (0.8rc5)          - Library to provide PyQt5 widgets to display spec file information read using spec2nexus.spec file library
    yxspkg_songzgif (1.3.2)           - A GUI to make gif based on pyqt5

我不知道该模块如何与搜索一起出现,但无法安装。

我在网上寻找答案,发现必须在PyQt5之前安装模块SIP。

有了这些信息,我尝试安装SIP,但是发生了同样的事情(在搜索中可见,但是在安装时找不到该模块)。

我还看到我们只能在Python 3.5上安装PyQt5。

这样,我得到了有关安装的python版本的信息:

python3 --version
    Python 3.6.3-r9
pip3 --version
    pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

我曾尝试过,但未能成功安装python 3.5。

我也尝试过,但是也没有用:

docker pull pypi/pyqt5
    Using default tag: latest
    latest: Pulling from pypi/pyqt5
    674ded4e0a75: Pulling fs layer
    a3ed95caeb02: Pulling fs layer
    3fe37ed373c9: Pulling fs layer
    ddf1745d8563: Pulling fs layer
    b9ef83e0e547: Pulling fs layer
    411d39b1247d: Pulling fs layer
    5b767d10beb4: Pulling fs layer
    25f5fdcb3950: Pulling fs layer
    a0ced0754594: Pulling fs layer
    ddf1745d8563: Waiting
    411d39b1247d: Waiting
    b9ef83e0e547: Waiting
    25f5fdcb3950: Waiting
    a0ced0754594: Waiting
    5b767d10beb4: Waiting
    a3ed95caeb02: Download complete
    ddf1745d8563: Verifying Checksum
    ddf1745d8563: Download complete
    3fe37ed373c9: Verifying Checksum
    3fe37ed373c9: Download complete
    411d39b1247d: Verifying Checksum
    411d39b1247d: Download complete
    5b767d10beb4: Verifying Checksum
    5b767d10beb4: Download complete
    b9ef83e0e547: Verifying Checksum
    b9ef83e0e547: Download complete
    25f5fdcb3950: Verifying Checksum
    25f5fdcb3950: Download complete
    a0ced0754594: Download complete
    674ded4e0a75: Verifying Checksum
    674ded4e0a75: Download complete
    674ded4e0a75: Pull complete
    a3ed95caeb02: Pull complete
    3fe37ed373c9: Pull complete
    ddf1745d8563: Pull complete
    b9ef83e0e547: Pull complete
    411d39b1247d: Pull complete
    5b767d10beb4: Pull complete
    25f5fdcb3950: Pull complete
    a0ced0754594: Pull complete
    Digest:     sha256:a213167f5f228b6f14e97e93af35f60a0864842846b4da4eb0ef85df5f381ad6
    Status: Downloaded newer image for pypi/pyqt5:latest

导入PyQt5时最后出现我的错误:

python3 -u tests.py
    Traceback (most recent call last):
    File "tests.py", line 3, in <module>
        import ProjectManager.Controller as controller
    File       "/builds/irmdataprocess/MIA2/src/modules/ProjectManager/Controller.py", line 4, in <module>
        import Utils.Utils as utils
    File "/builds/irmdataprocess/MIA2/src/modules/Utils/Utils.py", line 2, in <module>
        from PyQt5.QtWidgets import QMessageBox
    ModuleNotFoundError: No module named 'PyQt5'

最好的问候,并感谢您的帮助:)

露西工人自助餐

现在,我的解决方案是使用apk安装pyqt5:

apk add py3-qt5

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章