这个错误是由于网络连接超时导致的下载中断。
1: 在终端里尝试使用清华镜像源来下载库
# 使用清华镜像源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch transformers pillow matplotlib scikit-learn tqdm pandas
# 或者使用阿里云镜像源
pip install -i https://mirrors.aliyun.com/pypi/simple/ torch transformers pillow matplotlib scikit-learn tqdm pandas
# 或者使用中科大镜像源
pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ torch transformers pillow matplotlib scikit-learn tqdm pandas
2: 增加超时时间和重试次数
# 增加超时时间到1000秒,并禁用缓存
pip --default-timeout=1000 --no-cache-dir install torch transformers pillow matplotlib scikit-learn tqdm pandas
# 或者使用镜像源+超时设置
pip --default-timeout=1000 -i https://pypi.tuna.tsinghua.edu.cn/simple install torch transformers pillow matplotlib scikit-learn tqdm pandas
3:分步安装,先安装较小的包
# 先安装较小的依赖包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow matplotlib scikit-learn tqdm pandas
# 再单独安装较大的torch和transformers
pip --default-timeout=1000 -i https://pypi.tuna.tsinghua.edu.cn/simple install torch
pip --default-timeout=1000 -i https://pypi.tuna.tsinghua.edu.cn/simple install transformers
4:使用conda安装(推荐)
# 使用conda安装torch(通常更稳定)
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
# 然后用pip安装其他包(使用镜像源)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple transformers pillow matplotlib scikit-learn tqdm pandas
1万+

被折叠的 条评论
为什么被折叠?



