How can I install Python 3.7 on an Apple Silicon (OSX-ARM64) machine?

Patricia Arquette
Release: 2024-11-11 21:07:03
Original
469 people have browsed it

How can I install Python 3.7 on an Apple Silicon (OSX-ARM64) machine?

Cannot install Python 3.7 on osx-arm64

Why is Python 3.7 apparently unavailable?

Since Python 3.8 had been released for about a year when Apple Silicon hit the market, Python 3.7 builds for osx-arm64 were never part of the regular build matrix for Conda Forge.

Workaround: Emulate

Immediate alternatives for using 3.7 on Apple Silicon systems would be to emulate x86_64 with Rosetta or use a container system, e.g., Docker.

Creating osx-64 environments

Similar to what one does for running win-32 environments on x86_64 machines, one can create osx-64 environments like

## create empty environment
conda create -n py37

## activate
conda activate py37

## use x86_64 architecture channel(s)
conda config --env --set subdir osx-64

## install python, numpy, etc. (add more packages here...)
conda install python=3.7 numpy
Copy after login


⚠️ Important Note: Be sure to always activate this environment before installing packages. Otherwise, the default CONDA_SUBDIR value (osx-arm64) may be active and could result in mixing architectures in the same environment.


Note that MacOS will automatically recognize the architecture and run through Rosetta (once installed) - one need not do anything special.

YAML

With a YAML environment definition, one can use the CONDA_SUBDIR environment variable to temporarily set the platform while creating the environment. Again, one still should set the environment-specific subdir option immediately after creation.

## create environment from YAML
CONDA_SUBDIR=osx-64 conda env create -n py37 -f py37.yaml

## activate
conda activate py37

## use x86_64 architecture channel(s)
conda config --env --set subdir osx-64
Copy after login

Requesting native build

Longer term, you could try requesting that the python-feedstock include a 3.7 build for osx-arm64. However, 3.7.12 (Sept. 2021) was technically the final feature release, and it has now entered the maintenance-only phase (see PEP 537). Also, other packages that build Python-version-specific variants would not be built for osx-arm64, so even if one had python=3.7, the packages wouldn't be there (at least not through Conda). Basically, I wouldn't bet on anyone taking this up.

The above is the detailed content of How can I install Python 3.7 on an Apple Silicon (OSX-ARM64) machine?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template