深度学习:windows环境下安装深度学习环境容易遇到的两个问题

一、CondaError: Downloaded bytes did not match Content-Length

1.问题描述

 

在执行类似如下命令时

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

出现错误信息:

CondaError: Downloaded bytes did not match Content-Length
url: https://repo.anaconda.com/pkgs/main/win-64pytorch-1.13.0-py3.8_cuda11.6_cudnn8_0
target_path: D:\Anaconda3\pkgs\pytorch-1.13.0-py3.8_cuda11.6_cudnn8_0
Content-Length: 16655961
downloaded bytes: 3798497

原因:原因一般是使用conda安装包下载的时候速度较慢,导致下载timeout而终止,从而未完成整个安装包的下载。

2.解决办法

方法一:配置国内镜像源

添加清华源:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/

方法二:设置下载超时限制

conda config --set remote_read_timeout_secs 600.0

二、InvalidArchiveError('Error with archive D:\MachineLearing\Miniconda\miniconda\pkgs\pytorch-1.13.0-py3.8_cuda11.6_cudnn8_0)

1.问题描述

warning conda.gateways.disk.delete:unlink_or_rename_to_trash(139): could not remove or rename D:\MachineLearing\Miniconda\miniconda\pkgs\pytorch-1.13.0-py3.8_cuda11.6_cudnn8_0\Lib\site-packages\torch\lib\torch.dll. please remove this file manually (you may need to reboot to free file handles)

原因:这是miniconda文件夹权限问题,一般将miniconda/anaconda安装D盘会出现这个问题。

2.解决办法

(1)选择miniconda文件夹右键属性,点击安全,发现的确当前的权限没有达到完全控制

深度学习:windows环境下安装深度学习环境容易遇到的两个问题_第1张图片

 (2)选择第二个,完全控制,然后点击确定

 深度学习:windows环境下安装深度学习环境容易遇到的两个问题_第2张图片

 (3)重新执行安装指令,安装成功!

 最后测试:

深度学习:windows环境下安装深度学习环境容易遇到的两个问题_第3张图片

 文章参考:win10下安装pytorch报错InvalidArchiveError(‘Error with archive D:\\anaconda\\pkgs\\pytorch-1.2.0-py3.6····_winnie爱学习的博客-CSDN博客

 

你可能感兴趣的:(深度学习,python,人工智能)