[英]Install different versions of a package on different platforms with poetry
在我的項目中,我需要同時支持 Linux 和 Windows,所以我遵循了這些准則並將這些行添加到我的pyproject.toml
文件中:
[tool.poetry.dependencies]
torch = [
{url="https://download.pytorch.org/whl/cu101/torch-1.4.0-cp36-cp36m-win_amd64.whl", markers="sys_platform=='win32'"},
{url="https://download.pytorch.org/whl/cu101/torch-1.4.0-cp36-cp36m-linux_x86_64.whl", markers="sys_platform!='win32'"}
]
(另外我試過os_name=='nt'
)但是當我嘗試運行poetry update
,我收到以下錯誤:
[RuntimeError]
The Poetry configuration is invalid:
- [dependencies.torch] [{'url': 'https://download.pytorch.org/whl/cu101/torch-1.4.0-cp36-cp36m-win_amd64.whl', 'markers': "sys_platform=='win32'"}, {'url': 'https://download.pytorch.org/whl/cu101/torch-1.4.0-cp36-cp36m-linux_x86_64.whl', 'markers': "sys_platform!='win32'"}] is not valid under any of the given schemas
使用 Poetry 在不同平台上安裝同一包的不同版本的正確方法是什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.