下载https://github.com/zeyad-mansour/lunar时遭遇PyTorch安装错误求助
下载lunar仓库时的PyTorch安装错误问题
下载lunar仓库时遇到PyTorch安装错误,执行pip install pytorch时出现如下错误提示:
pip install pytorch Collecting pytorch Using cached pytorch-1.0.2.tar.gz (689 bytes) Preparing metadata (setup.py) ... done Building wheels for collected packages: pytorch Building wheel for pytorch (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\isamu\AppData\Local\Temp\pip-install-ib00i94p\pytorch_f353fda7bc1a41bdabf99f644cf66bcb\setup.py", line 15, in raise Exception(message) Exception: You tried to install "pytorch". The package named for PyTorch is "torch" [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pytorch Running setup.py clean for pytorch Failed to build pytorch Installing collected packages: pytorch Running setup.py install for pytorch ... error error: subprocess-exited-with-error × Running setup.py install for pytorch did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\isamu\AppData\Local\Temp\pip-install-ib00i94p\pytorch_f353fda7bc1a41bdabf99f644cf66bcb\setup.py", line 11, in raise Exception(message) Exception: You tried to install "pytorch". The package named for PyTorch is "torch" [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> pytorch note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
已尝试以下命令,但问题仍未解决:
pip install torch pip3 install efficiencynet_pytorch pip install pytorch
解决方案
- 核心问题:你安装的包名错误,PyTorch官方pip包名是
torch,pytorch只是一个占位包,会主动抛出错误提示;另外你输入的efficiencynet_pytorch存在拼写错误,正确包名是efficientnet_pytorch。 - 执行以下步骤修复:
- 卸载错误的占位包(如有残留):
pip uninstall -y pytorch - 安装正确的PyTorch包:
若需匹配特定CUDA版本,可根据系统环境调整命令(比如CUDA 11.8版本:pip install torchpip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118) - 安装项目依赖的正确包:
pip install efficientnet_pytorch - 验证安装是否成功:
python -c "import torch; print(torch.__version__)"
- 卸载错误的占位包(如有残留):
内容的提问来源于stack exchange,提问作者Dilicates
相关产品推荐
相关产品推荐

