简体   繁体   中英

Troubles installing Numpy 1.19.5 with Python 3.9.1 on macOS BigSur

Like the title says, I'm on macOS Big Sur 11.1 with Apple silicon. I Just installed Python 3.9.1 from the downloadable link on python.org. When I try to install Numpy 1.19.5 as follows:

python3 -m pip install numpy -U

I get the following (truncated) output:

Collecting numpy
  Using cached numpy-1.19.5.zip (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517) ... error
.
.
.
  ----------------------------------------
  ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly

I've tried downgrading numpy as follows:

python3 -m pip install numpy==1.15.3

and I get similar errors. Thanks in advance!

This is because Numpy is not available for python version 3.9 yet. Just create a new conda environment with version 3.8:

conda create -n ENV_NAME python=3.8.5

... and install Numpy via pip

pip install numpy

Works like a charm on M1 and macOS Big Sur. This workaround is also the output of this GitHub issue: https://github.com/numpy/numpy/issues/17807

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM