Anaconda 环境 国内镜像配置及Tensorflow 阿里镜像无法下载或下载中断的问题解决

本文提供了Anaconda的下载链接及安装步骤,特别提示在安装时建议勾选添加到PATH。对于国内用户,推荐配置清华、阿里云等国内镜像以加速下载。在安装Tensorflow时,由于可能出现网络问题,文中建议使用不同的镜像源如豆瓣进行安装,并给出了相应的pip命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Anaconda 下载

最新版本下载链接:https://www.anaconda.com/products/distribution
旧版本的下载链接:https://repo.anaconda.com/archive/
安装步骤比较简单 基本上是下一步

  1. 这里个人开发学习,建议 just me
    在这里插入图片描述
  2. 另一个步骤 :path 建议,大家都进行勾选。
    在这里插入图片描述
    3.验证环境
    按键 Ctrl+R 打开cmd
    在这里插入图片描述
conda list

在这里插入图片描述

国内镜像配置

镜像资源:
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣:http://pypi.douban.com/simple/

1.使用Admin 权限Anaconda Prompt
在这里插入图片描述
2.
代码指令输入:
这里的链接大家自己根据需求进行更换。

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 --set show_channel_urls yes

小编这里用的是阿里云的
3. 点击update channels 查看是否添加成功。
在这里插入图片描述

Tensorflow 安装问题解决:

我开始用的是阿里云的镜像
pip install tensorflow

pip install tensorflow 

命令来进行下载的,但是会出现Read timed out.类似报错
我尝试选择国内其他的镜像源来安装尝试,命令如下:

pip install tensorflow -i https://pypi.douban.com/simple

执行完成后点击update index
检查,这时虽然列表没有keras,但是Tensorflow包内已经下载了Keras版本
在这里插入图片描述

### 使用国内镜像通过Anaconda Navigator安装TensorFlow #### 创建并激活新的环境 为了确保最佳性能和兼容性,建议先创建一个新的Conda环境专门用于TensorFlow。这可以防止不同包之间的版本冲突。 ```bash conda create --name tf_env python=3.8 conda activate tf_env ``` #### 设置国内镜像源 对于加速下载过程以及提高稳定性,可以通过修改`.condarc`文件来设置默认使用的镜像源为清华大学TUNA镜像其他可靠的中国境内镜像站点[^1]。 ```yaml channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - defaults show_channel_urls: true 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 simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud ``` 上述配置可以直接写入用户的home目录下的`.condarc`文件中,者通过命令行工具动态更改当前会话中的渠道优先级: ```bash conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ conda config --set show_channel_urls yes ``` #### 安装TensorFlow及相关依赖项 一旦设置了合适的镜像源之后,就可以继续按照常规流程安装所需的软件包了。这里推荐使用pip而不是conda来进行TensorFlow本身的安装,因为这样可以获得最新版本的支持,并且能够更好地管理Python包间的复杂关系。 ```bash pip install tensorflow==2.4.0 -i https://pypi.tuna.tsinghua.edu.cn/simple ``` 这条命令指定了特定版本(2.4.0)的TensorFlow并通过清华PyPI镜像服务器获取资源,从而加快下载速度并减少可能出现的问题[^4]。 #### 将新环境集成至Jupyter Notebook 最后一步是让刚刚创建好的带有TensorFlow支持的新环境能够在Jupyter notebook里被识别出来。为此需要执行如下操作: ```bash conda install ipykernel python -m ipykernel install --user --name=tf_env --display-name "Python (tf_env)" ``` 现在启动Jupyter notebook时就应该能看到名为“Python (tf_env)”的选择选项了,选择它即可以在notebook内运行基于此环境中已安装的所有库的应用程序。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值