[Python] How to add OpenCV as precompiled library in Poetry?

Discussão em 'Python' iniciado por Stack, Maio 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to add OpenCV to my virtual environment with Poetry. OpenCV is already installed globally and can be used globally in python, but not in a virtual environment created by Poetry.

    I added the library to poetry like this:

    [tool.poetry.dependencies]
    cv2 = { path = "/usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.cpython-38-aarch64-linux-gnu.so" }


    When trying to install it with poetry install I get the following error message:

    ReadError

    file could not be opened successfully

    at /usr/local/lib/python3.8/tarfile.py:1608 in open
    1604│ except (ReadError, CompressionError):
    1605│ if fileobj is not None:
    1606│ fileobj.seek(saved_pos)
    1607│ continue
    → 1608│ raise ReadError("file could not be opened successfully")
    1609│
    1610│ elif ":" in mode:
    1611│ filemode, comptype = mode.split(":", 1)
    1612│ filemode = filemode or "r"


    How can I add globally installed precompiled libraries to my poetry environment?

    Continue reading...

Compartilhe esta Página