Mac M1 conda安装python2.7版本
问题说明
我想在我的mac电脑上安装 python2.7,发现不支持。
conda 上也安装不了相应的环境。
解决方法
其主要思路就是使用Mac 的Rosetta2 来模拟x86_64环境,来安装python2.7
Not natively. Python 2.7 was sunsetted prior to release of the osx-arm64 platform, so there isn't any such build. One could try requesting such a build on the Conda Forge Python feedstock, but even if someone did that you'd still face the issue that most Python packages will also lack osx-arm64 builds for Python 2.7.
Possibly through Rosetta. Instead, one could try using Apple's x86_64 emulator, Rosetta 2, to run Conda environments with an osx-64 subdir. This could be dicey (not tested - someone needs to buy me a M1 :), but one can create an environment based on other architectures along these lines:
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
Just be mindful to always have the environment activated when installing any additional packages. Rosetta should automatically kick in when launching python with such an environment activated.
在原生情况,Python 2.7并不支持 osx-arm64 平台。Python 2.7在osx-arm64平台发布之前就已经结束了生命周期,因此没有相应的构建版本。人们可以尝试在Conda Forge的Python feedstock上请求这样的构建,但即使有人这样做,你仍然会面临大多数Python软件包也将缺乏针对Python 2.7的osx-arm64构建的问题。
可能通过Rosetta实现。人们可以尝试使用Apple的x86_64模拟器,即Rosetta 2,来运行具有osx-64子目录的Conda环境。这可能是不稳定的(未经测试),但可以按照这样的思路创建基于其他架构的环境:
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
需要注意的是以后每次安装软件的时候,都需要激活这个环境。 我理解的是加入 CONDA_SUBDIR=osx-64