You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在VS Code与Conda中创建Python3.9.13环境失败,求解决办法

解决Conda创建Python 3.9.13环境失败的问题

我当前使用Python 3.9.13,尝试在VS Code中创建新的Conda环境,执行命令conda create -n <environment name> python=3.9.13 anaconda时出现网络错误:

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/main/win-64/current_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://www.anaconda.com blocked, please file
a support request with your network engineering team.

'https//repo.anaconda.com/pkgs/main/win-64'

重试后错误依旧,且确认网络未屏蔽anaconda.com。在Anaconda Prompt执行相同命令,得到如下提示:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • python=3.9.13

Current channels:

  • https://repo.anaconda.com/pkgs/main/win-64
  • https://repo.anaconda.com/pkgs/main/noarch
  • https://repo.anaconda.com/pkgs/r/win-64
  • https://repo.anaconda.com/pkgs/r/noarch
  • https://repo.anaconda.com/pkgs/msys2/win-64
  • https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

推测原因是Python 3.9.13未在Conda默认渠道适配,以下是可行的解决办法:

  • 使用Conda支持的Python 3.9.x子版本
    Conda默认渠道中Python 3.9系列有多个可用子版本,比如3.9.16(最新稳定版),可以修改命令为:

    conda create -n <environment name> python=3.9 anaconda
    

    这样会自动安装Conda渠道中最新的兼容Python 3.9版本;如果需要指定具体可用子版本,先执行conda search python=3.9查看所有可用的3.9系列版本,再选择合适版本创建环境。

  • 添加conda-forge渠道
    conda-forge社区渠道通常提供更丰富的包版本支持,先添加渠道并设置优先级,再创建环境:

    conda config --add channels conda-forge
    conda config --set channel_priority strict
    conda create -n <environment name> python=3.9.13 anaconda
    

    注意:添加conda-forge后可能引发包依赖冲突,若环境求解失败,可去掉anaconda元包,先安装核心Python环境,之后按需安装所需包:

    conda create -n <environment name> python=3.9.13
    
  • 手动指定Python包的安装路径
    若坚持使用Python 3.9.13,可从Python官方下载对应版本安装包,手动安装到Conda环境:

    1. 创建空Conda环境:
      conda create -n <environment name>
      
    2. 激活环境:
      conda activate <environment name>
      
    3. 下载Python 3.9.13的Windows安装包,运行时选择「Customize installation」,将安装路径指定到Conda环境的根目录(通常为Anaconda3/envs/<environment name>),覆盖原有文件。
  • 修复VS Code中的网络问题
    之前在VS Code中出现的网络错误,可能是代理配置问题:

    1. 打开VS Code设置,搜索http.proxy,检查是否设置了错误代理;
    2. 若无需代理,清空http.proxy和https.proxy配置,或在确认安全的情况下勾选http.proxyStrictSSL为false;
    3. 重启VS Code后再次尝试创建环境。

内容的提问来源于stack exchange,提问作者pops101

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 02:54:25