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

Mac Monterey系统下用Anaconda创建Python2.7环境失败求助

解决Mac Monterey 12.6.4下conda创建Python2.7环境失败的问题

问题重现

执行命令:

conda create -n python2 python=2.7 anaconda

出现报错:

Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): | WARNING conda.models.version:get_matcher(556): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.8.0.*, but conda is ignoring the .* and treating it as 1.8.0
WARNING conda.models.version:get_matcher(556): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.9.0.*, but conda is ignoring the .* and treating it as 1.9.0
done
Solving environment: failed

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

  - python=2.7

原因

Python2.7已停止官方维护,conda默认的defaults频道已移除相关包;如果是Apple Silicon(M系列芯片)Mac,还存在Python2.7无原生arm64编译包的问题。

解决方案

1. 针对Apple Silicon用户:切换到x86终端

打开终端,先执行以下命令切换到x86架构的shell(利用Rosetta2兼容):

arch -x86_64 zsh

(如果用bash,替换成arch -x86_64 bash)

2. 指定conda-forge频道创建环境

conda-forge频道仍保留Python2.7的兼容包,执行以下命令:

conda create -n python2 python=2.7 anaconda -c conda-forge

3. 若上述命令仍失败:精简环境后手动装包

如果安装整个anaconda元包失败,先创建仅含Python2.7的基础环境:

conda create -n python2 python=2.7 -c conda-forge

激活环境后按需安装需要的包,比如:

conda activate python2
conda install numpy pandas matplotlib -c conda-forge

内容的提问来源于stack exchange,提问作者Antonio.Aubry

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 04:55:13