用于安装python 2.7的Anaconda通道



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

conda create --name osmEnv python=2.7

我最终出现以下错误,

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.

正如添加新频道的评论中所建议的那样(最初的问题(,我也尝试使用anaconda频道

conda create --name osmEnv -c anaconda python=2.7

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

非本机Python 2.7是在osx-arm64平台发布之前发布的,因此没有任何这样的构建。可以尝试在Conda Forge Python原料上请求这样的构建,但即使有人这样做了,你仍然会面临这样的问题,即大多数Python包也将缺乏针对Python 2.7的osx-arm64构建。

通过罗塞塔进行仿真。苹果提供了一个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

安装任何附加软件包时,请注意始终激活环境。在这样的环境激活的情况下,罗塞塔应该会在启动python时自动启动。

最新更新