Home > Backend Development > Python Tutorial > How Can I Install Python 3.7 on macOS with Apple Silicon?

How Can I Install Python 3.7 on macOS with Apple Silicon?

Susan Sarandon
Release: 2024-11-08 04:49:01
Original
924 people have browsed it

How Can I Install Python 3.7 on macOS with Apple Silicon?

Cannot install Python 3.7 on osx-arm64

Conda currently does not provide native builds of Python 3.7 for osx-arm64 due to various reasons, primarily because Python 3.8 had already been released when Apple Silicon hit the market, and since Python 3.7.12 was the final feature release and has entered the maintenance-only phase, it is unlikely that a native build for 3.7 will be provided.

Workaround: Emulating

Instead of waiting for a native build, you can emulate Python 3.7 on an Apple Silicon system using Rosetta or a container system like Docker.

Creating osx-64 environments

To create osx-64 environments, you can follow these steps:

  1. Create an empty environment:
conda create -n py37
Copy after login
  1. Activate the environment:
conda activate py37
Copy after login
  1. Set the osx-64 architecture channel:
conda config --env --set subdir osx-64
Copy after login
  1. Install the desired Python version and packages:
conda install python=3.7 numpy
Copy after login

YAML

Alternatively, you can use a YAML environment definition.

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

# Activate the environment
conda activate py37

# Set the osx-64 architecture channel
conda config --env --set subdir osx-64
Copy after login

Requesting a Native Build

While it is possible to request a native build of Python 3.7 for osx-arm64, it is unlikely to be approved since Python 3.8 is the recommended version and other package variants would need to be built for osx-arm64 as well.

The above is the detailed content of How Can I Install Python 3.7 on macOS with Apple Silicon?. 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