用于安装 python 2.7 的 Anaconda 通道

ima*_*tha 11 macos conda

由于我的 Mac 带有 M1 芯片,因此无法使用常规版本的 anaconda 安装 Tensorflow,因此我使用 conda 安装miniforge3-MacOSX-arm64.sh。但是现在我无法使用 python 2.7 创建环境。

conda create --name osmEnv python=2.7
Run Code Online (Sandbox Code Playgroud)

我最终出现以下错误,

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

  - python=2.7

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/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.
Run Code Online (Sandbox Code Playgroud)

正如添加新通道(原始问题)的评论中所建议的,我也尝试使用 anaconda 通道,

conda create --name osmEnv -c anaconda python=2.7
Run Code Online (Sandbox Code Playgroud)

这导致了同样的错误。关于如何安装 python 2.7 的任何想法。

mer*_*erv 39

不是原生的。Python 2.7 在osx-arm64平台发布之前就已废弃,因此不存在任何此类构建。人们可以尝试在Conda Forge Python feedstock上请求这样的构建,但即使有人这样做,你仍然会面临大多数 Python 包也缺少 Python 2.7 的osx-arm64构建的问题。

通过Rosetta 进行仿真。Apple 提供了一个 x86_64 模拟器Rosetta 2,它将运行 x86_64 二进制文件,例如使用osx-64子目录在 Conda 环境中安装的二进制文件。subdir人们可以通过以下方式创建具有这样的设置的环境:

CONDA_SUBDIR=osx-64 conda create -n py27 python=2.7  # include other packages here

# ensure that future package installs in this env stick to 'osx-64'
conda activate py27
conda config --env --set subdir osx-64
Run Code Online (Sandbox Code Playgroud)

请注意,在安装任何其他软件包时始终激活环境。python在激活此类环境的情况下启动时,Rosetta 应该会自动启动。