小编for*_*qed的帖子

Python 2.7 通过pip(虚拟环境)安装opencv

我正在尝试通过 pip 在虚拟环境(Python 2.7)中安装 opencv-python 包。不幸的是,我收到一个错误:

(venv) $ pip2 install opencv-python
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting opencv-python
  Using cached opencv-python-4.3.0.38.tar.gz (88.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command …
Run Code Online (Sandbox Code Playgroud)

opencv pip virtualenv python-2.7

49
推荐指数
1
解决办法
2万
查看次数

PyQt5 在窗口之间切换

我想基于磁贴创建菜单。现在我需要 PyQt5 概念如何将 MainWindow 切换到 Window1/Window2/... 并返回 MainWindow 选项。我唯一取得的成就是在顶部打开一个新窗口。我宁愿有单独的窗口,我可以在其中定义不同的功能。

from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5.QtCore import pyqtSlot
import sys

class Window(QMainWindow):
    def __init__(self):
        super().__init__()
        self.title = "App"
        self.top = 100
        self.left = 100
        self.width = 680
        self.height = 500
        self.InitUI()

    def InitUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.top, self.left, self.width, self.height)

        buttonWindow1 = QPushButton('Window1', self)
        buttonWindow1.move(100, 100)
        buttonWindow1.clicked.connect(self.buttonWindow1_onClick)

        buttonWindow2 = QPushButton('Window2', self)
        buttonWindow2.move(100, 200)
        buttonWindow2.clicked.connect(self.buttonWindow2_onClick)

        self.show()

    @pyqtSlot()
    def buttonWindow1_onClick(self):
        self.statusBar().showMessage("Switched to window 1")

    @pyqtSlot()
    def buttonWindow2_onClick(self):
        self.statusBar().showMessage("Switched to …
Run Code Online (Sandbox Code Playgroud)

pyqt pyqt5

1
推荐指数
1
解决办法
9042
查看次数

标签 统计

opencv ×1

pip ×1

pyqt ×1

pyqt5 ×1

python-2.7 ×1

virtualenv ×1