pip安装报错after connection broken by ‘ProxyError(‘Cannot connect to proxy.‘, OSError(0, ‘Error‘))

一、创建一个新环境后用pip list
出现WARNING: There was an error checking the latest version of pip.
解决办法:

conda config ##在C盘用户目录下生成一个.condrac文件
 
 打开这个文件,删除{},将下面这段复制进去
 channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

二、用pip安装pytorch时报错
主要原因:打开了那个xxx软件

pip安装报错after connection broken by ‘ProxyError(‘Cannot connect to proxy.‘, OSError(0, ‘Error‘))_第1张图片

然后又报错时间error
用以下指令终于安装好了

pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.tuna.tsinghua.edu.cn/simple/

所以我的环境最终配置是

python3.7
torch1.8.1
cuda 10.2
torchvision 0.9.1

你可能感兴趣的:(bug,pip,python,pytorch)