300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:错误解决方法

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:错误解决方法

时间:2023-11-07 20:27:47

相关推荐

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:错误解决方法

在windows10上用pip命令pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f /whl/torch_stable.html安装pytorch时遇到如下问题:

PS C:\Users\mgn10> pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f /whl/torch_stable.htmlLooking in links: /whl/torch_stable.htmlCollecting torch==1.7.1+cu101Using cached /whl/cu101/torch-1.7.1%2Bcu101-cp37-cp37m-win_amd64.whl (1204.8 MB)Collecting torchvision==0.8.2+cu101Using cached /whl/cu101/torchvision-0.8.2%2Bcu101-cp37-cp37m-win_amd64.whl (1.5 MB)Collecting torchaudio==0.7.2Using cached /whl/torchaudio-0.7.2-cp37-none-win_amd64.whl (103 kB)Requirement already satisfied: typing-extensions in c:\users\mgn10\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from torch==1.7.1+cu101) (3.10.0.0)Requirement already satisfied: numpy in c:\users\mgn10\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from torch==1.7.1+cu101) (1.20.3)Requirement already satisfied: pillow>=4.1.1 in c:\users\mgn10\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from torchvision==0.8.2+cu101) (8.2.0)Installing collected packages: torch, torchvision, torchaudioERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\mgn10\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python37\\site-packages\\caffe2\\python\\serialized_test\\data\\operator_test\\collect_and_distribute_fpn_rpn_proposals_op_test.test_collect_and_dist.zip'

在reddit上找到了能用的解决办法。

错误的原因大概是路径长度超过256系统报错,所以我们需要做的

1.补上collect_and_distribute_fpn_rpn_proposals_op_test.test_collect_and_dist.zip文件。

2.改一下系统内部设置

具体方法

1.在这里下载缺失文件,放到缺失的地方。

2.打开powershell,输入regedit.exe打开注册表编辑器,定位到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem双击 LongPathsEnabled,把0改为1,保存关闭。

3. 重新运行安装命令。

PS C:\Users\mgn10> pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f /whl/torch_stable.htmlLooking in links: /whl/torch_stable.htmlCollecting torch==1.7.1+cu101Using cached /whl/cu101/torch-1.7.1%2Bcu101-cp37-cp37m-win_amd64.whl (1204.8 MB)Collecting torchvision==0.8.2+cu101Using cached /whl/cu101/torchvision-0.8.2%2Bcu101-cp37-cp37m-win_amd64.whl (1.5 MB)Collecting torchaudio==0.7.2Using cached /whl/torchaudio-0.7.2-cp37-none-win_amd64.whl (103 kB)Requirement already satisfied: typing-extensions in c:\users\mgn10\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from torch==1.7.1+cu101) (3.10.0.0)Requirement already satisfied: numpy in c:\users\mgn10\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from torch==1.7.1+cu101) (1.20.3)Requirement already satisfied: pillow>=4.1.1 in c:\users\mgn10\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from torchvision==0.8.2+cu101) (8.2.0)Installing collected packages: torch, torchvision, torchaudioWARNING: The scripts convert-caffe2-to-onnx.exe and convert-onnx-to-caffe2.exe are installed in 'C:\Users\mgn10\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.Successfully installed torch-1.7.1+cu101 torchaudio-0.7.2 torchvision-0.8.2+cu101PS C:\Users\mgn10> pythonPython 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 , 16:30:00) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import torch>>> torch.cuda.is_available()True>>> exit()

重新安装成功。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。