想把pytorch的版本回退到1.6.0.所以重新安装pytorch。
在清华镜像源的条件下在conda环境下输入
conda install pytorch==1.6.0 torchvision==0.7.0

但安装过程中报警如下:

WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:\anaconda\pkgs\pytorch-1.6.0-py3.7_cuda101_cudnn7_0.tar.bz2. Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:\anaconda\pkgs\pytorch-1.6.0-py3.7_cuda101_cudnn7_0\Lib\site-packages\torch\lib\torch_cuda.dll. Please remove this file manually (you may need to reboot to free file handles)

此处参考过该处理办法,没能解决,但我也将权限打开。
后来,索性按照提示,手动将“D:\anaconda\pkgs\pytorch-1.6.0-py3.7_cuda101_cudnn7_0.tar.bz2.”和“D:\anaconda\pkgs\pytorch-1.6.0-py3.7_cuda101_cudnn7_0\Lib\site-packages\torch\lib\torch_cuda.dll.”所指代的文件给删除,不再报错。
最后安装成功,并显示版本号

import torch
print(torch.__version__)  #注意是双下划线

显示成功

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐