pip install 安装时,具体报错内容如下
Collecting pytorch-lightning1.7.2
Downloading https://mirrors.aliyun.com/pypi/packages/a1/37/40a0ade0d4bf9abcdae109ec6f306be0e5a8d5d19ae8adce811cbcacedce/pytorch_lightning-1.7.2-py3-none-any.whl (705 kB)
WARNING: Ignoring version 1.7.2 of pytorch-lightning since it has invalid metadata:
Requested pytorch-lightning1.7.2 from https://mirrors.aliyun.com/pypi/packages/a1/37/40a0ade0d4bf9abcdae109ec6f306be0e5a8d5d19ae8adce811cbcacedce/pytorch_lightning-1.7.2-py3-none-any.whl#sha256=faea45653bb759ee2e5c5e26491bd144260de2b4d87f37ebe8b3cc2a9b801b76 has invalid metadata: .* suffix can only be use
d with == or != operators
torch (>=1.9.*)
~~~~~~^
Please use pip<24.1 if you need to use this version.
Please use pip<24.1 if you need to use this version.
ERROR: Could not find a version that satisfies the requirement pytorch-lightning1.7.2 (from versions:…
ERROR: No matching distribution found for pytorch-lightning1.7.2

##提示torch版本不对,但是明明我的torch版本是1.11,很奇怪, 网上搜了好久没找到合适的方法,目前能解决的方法就是硬改文件:
下载pytorch-lightning的whl文件,然后解压 .whl 文件,手动修改其中的 METADATA 文件,然后重新打包安装
解压 .whl 文件(可以把 .whl 扩展名改为 .zip 然后解压,也可以直接换打开方式)。
编辑解压后的文件夹中的 METADATA 文件,

找到 Requires-Dist 字段,比如将 torch (>=1.9.*) 修改为 torch (>=1.9.0) 或其他合适的条件,同样的操作对torchvision以及其他库修改(如有类似报错)。

然后保存更新。
使用修改后的 .whl 文件进行安装。

1700

被折叠的 条评论
为什么被折叠?



