毛毛张今天分享一个深度学习环境中一个报错的可能解决方案
1.报错
- 问题背景:
conda create -n rag python=3.10
- 报错:
SafetyError: The package for python located at /opt/anaconda3/pkgs/python-3.7.10-hdb3f193_0 appears to be corrupted. The path 'lib/python3.7/os.py' has an incorrect size. reported size: 37901 bytes actual size: 37913 bytes
2.解决方案
- 毛毛张碰到这个问题是发现在安装python的时候,有些依赖根本没有安装,于是想着是因为在镜像源中没有找到这些包,于是重新配置
conda
镜像源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/pytorch/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/ conda config --set show_channel_urls yes
- 接着删除
conda
命令在安装过程中的一些缓存conda clean -a
- 然后删除刚刚创建的虚拟环境
conda remove -n env_name --all
- 然后再重新创建虚拟环境
conda create -n rag python=3.10
3 总结
- 深度学习环境真的会逼疯大学生,不同的环境会遇到不同的问题,所以很难有一种方法能在整个配置过程中不会出错,只有见多了,才有可能减少出错