Anaconda无法创建指定版本Python环境问题求助
解决方案
1. 配置conda-forge源
默认defaults源可能已下架Python 3.7这类旧版本包,或是源配置存在异常。执行以下命令添加优先级更高的conda-forge源:
conda config --add channels conda-forge conda config --add channels bioconda conda config --add channels defaults conda config --set channel_priority strict
2. 清理conda缓存
缓存的旧元数据会干扰版本检索,执行清理命令:
conda clean --all -y
3. 指定源重新创建环境
针对Python 3.7环境,明确使用conda-forge源创建:
conda create -n keras python=3.7 -c conda-forge
若Python 3.9环境创建仍失败,同样指定源:
conda create -n py39_env python=3.9 -c conda-forge
4. 用mamba替代conda(可选)
mamba的环境求解效率更高、稳定性更强,适合解决复杂环境创建问题:
- 先安装mamba:
conda install mamba -n base -c conda-forge
- 再用mamba创建环境:
mamba create -n keras python=3.7
额外排查项
- 确认网络连接正常,可访问conda源服务器;
- 若处于公司内网,需配置代理(替换为实际代理地址):
conda config --set proxy_servers.http http://proxy:port conda config --set proxy_servers.https https://proxy:port
内容的提问来源于stack exchange,提问作者수루룩끼루룻
相关产品推荐
相关产品推荐

