我正在尝试使用Poetry将OpenCV添加到我的虚拟环境中。OpenCV已经全局安装,可以在python中全局使用,但不能在Poetry创建的虚拟环境中使用。
我将库添加到诗歌中,如下所示:
[tool.poetry.dependencies]
cv2 = { path = "/usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.cpython-38-aarch64-linux-gnu.so" }当尝试用poetry install安装它时,我得到了以下错误消息:
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"如何将全局安装的预编译库添加到我的诗歌环境中?
发布于 2021-06-01 01:39:45
删除pyproject.toml中的行cv2。在poetry中,我们使用'poetry packagename‘命令在虚拟环境中添加包,例如,poetry django-restframework。确保您的终端在pyproject.toml文件所在的文件夹中打开。
https://stackoverflow.com/questions/67658426
复制相似问题