在我的项目中,我需要同时支持 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 在不同平台上安装同一软件包的不同版本的正确方法是什么?