我正在尝试使用 conda 指令创建一个新环境(在 Mac M1 上):
conda create --name tf2 python==3.9
但我收到一条错误消息:
Channels:
- defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python==3.9
Current channels:
- defaults
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.
为什么以及我应该做什么?
使用一个等号:
conda create -n tf2 python=3.9
Conda 语法与 Pip 不同。在 Conda 中,两个等号表示完全匹配,而
3.9
不是正确的版本。该系列的第一个版本是 3.9.0,3.9.6 是第一个基于 defaults
通道构建的 osx-arm64。然而,大多数用户几乎总是想要最新的补丁,这就是
python=3.9
所提供的。也就是说,Conda 将其解释为 3.9.*
。