PermissionError(13, 'Permission denied')

因为借用另一个电脑需要重新配置pytorch环境,由于此电脑conda的问题出现了一些bug,记录下来.

conda安装pytorch最后一步后出现:

ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py27_0'.
OSError(13, 'Permission denied')
Attempting to roll back.

Rolling back transaction: done

OSError(13, 'Permission denied')

显而易见,是conda的原因.

看了文章说是需要更新conda,于是

conda update -n base conda

可是依然报错:

The following packages will be DOWNGRADED:

    conda: 4.5.4-py27_0 --> 4.3.30-py27h6ae6dc7_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py27_0'.
OSError(13, 'Permission denied')
Attempting to roll back.

Rolling back transaction: done

OSError(13, 'Permission denied')
 

查了一下,应该是anaconda所在文件夹只有root 才有权限,而 sudo 对于conda没用,解决方案是修改文件夹权限给当前用户.

sudo chown -R usr foldername

比如我的就是

yyf@yyf:~$ sudo chown -R yyf /home/yyf/anaconda2
 

然后安装pytorch

conda install pytorch torchvision cuda80 -c pytorch

成功!

 

 

 

你可能感兴趣的:(工具安装,pytorch)