win10通过Anaconda安装tensorflow过程中遇到的 An HTTP error occurred和ConnectTimeout的 问题

本文详细介绍了在Anaconda环境下安装TensorFlow的过程,包括解决网络代理问题的方法,通过配置.condarc文件来实现HTTP和HTTPS代理,确保在受限网络环境中也能顺利完成TensorFlow及相关依赖包的安装。
部署运行你感兴趣的模型镜像

通过我的上一篇博客的安装过程中,有些网络会存在

 An HTTP error occurred when trying to retrieve this URL.
 HTTP errors are often intermittent, and a simple retry will get you on your way.
 ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/repodata.json (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000004E62470>, 'Connection to conda.anaconda.org timed out. (connect timeout=9.15)'))",),)
 
 Error: Error 1 occurred installing packages into conda environment r-tensorflow
 In addition: Warning message:
 running command '"D:\DATA\user\APPLIC~1\ANACON~1\Scripts\conda.exe" "install" "-c" "conda-forge" "--yes" "--name" "r-tensorflow" "tensorflow" "h5py" "pyyaml" "requests" "Pillow" "keras" "scipy"' had status 1 

等一系列问题,我找了很久才找到解决办法,

直接找到.condarc文件

然后打开.condarc文件

对照我写的配置好如下几列:

proxy_servers:
http: http://user:pass@proxy1:port
https: https://user:pass@proxy2.18:port

保存然后再执行命令就可以执行conda的命令啦。

 

1.安装Anaconda

选择相应的Anaconda进行安装,下载地址点击这里,下载对应系统版本的Anaconda,官网现在的版本是Anaconda 4.3.1 for python3.6。笔者安装的是4.3.0版本的。 
这里写图片描述

就和安装普通的软件一样,全部选择默认即可,注意勾选将python3.6添加进环境变量。 
这里写图片描述

这样Anaconda就安装好了,我们可以通过下面的命令来查看Anaconda已经安装了哪些包。 
运行 开始菜单->Anaconda3—>Anaconda Prompt :

conda list
  • 1
  • 1

可以看到已经安装了numpy、sympy等常用的包。

2.安装Tensorflow

TensorFlow目前在Windows下只支持python 3.5版本。

(1)打开Anaconda Prompt,输入清华仓库镜像,这样更新会快一些: 
这里写图片描述

 
  1. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

  2. conda config --set show_channel_urls yes

  • 1
  • 2
  • 1
  • 2

(2)同样在Anaconda Prompt中利用Anaconda创建一个python3.5的环境,环境名称为tensorflow ,输入下面命令:

conda create -n tensorflow python=3.5

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

(base) C:\Users\Administrator>conda create -n yolov10 python=3.10 3 channel Terms of Service accepted Channels: - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2 - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - defaults Platform: win-64 Collecting package metadata (repodata.json): / Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=t \ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'Connectiont - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout \ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoun - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout / Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout | Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout | Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeout failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/msys2/noarch/repodata.json> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. If your current network has https://repo.anaconda.com blocked, please file a support request with your network engineering team. 'https//repo.anaconda.com/pkgs/msys2/noarch'解决一下这个问题
最新发布
08-16
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值