无法在 Gitlab CI 中使用 pip3 安装 python3 PyQt5 模块
Posted
技术标签:
【中文标题】无法在 Gitlab CI 中使用 pip3 安装 python3 PyQt5 模块【英文标题】:Impossible to install python3 PyQt5 module with pip3 in Gitlab CI 【发布时间】:2018-03-22 18:17:21 【问题描述】:我是 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'
最好的问候和感谢您的帮助:)
【问题讨论】:
从wheel文件from pypi安装 我用 -wget 从这里下载它? pypi.python.org/pypi/PyQt5/5.6 之后我做 pip3 install目前,我的解决方案是用apk安装pyqt5:
apk add py3-qt5
【讨论】:
以上是关于无法在 Gitlab CI 中使用 pip3 安装 python3 PyQt5 模块的主要内容,如果未能解决你的问题,请参考以下文章