我正试图用诗歌将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"
如何将全局安装的预编译库添加到诗歌环境中
删除pyproject.toml中的行cv2。 在poetry中,我们使用“poetry add packagename”命令在虚拟环境中添加包 例如,诗歌添加了django restframework。 确保终端在pyproject.toml文件所在的文件夹中打开
相关问题 更多 >
编程相关推荐