Mac M1 chip installation Numpy Pandas

This article teaches you how to easily install Numpy and Pandas on the M1 chip MacBook.

I just bought a Mac Pro with an M1 chip, but I encountered various inexplicable problems when installing Numpy and Pandas

The first type of error is very long and omitted

The second type of error

ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly

Searching for various solutions, some said to install Miniforge, some said to install Anaconda, some said to install through Rosetta, and what's more, they said to install tensflow. Damn, I just want to install numpy, so it’s not possible.

The following will teach you a simple and effective way to install numpy and pandas on the M1 mac, without further ado, let’s get started.

1. Upgrade Python

The Python that comes with the Mac is version 3.8. I have been entangled with this for a long time, but the problem has not been solved, so I upgraded to version 3.9 decisively.

Python Releases for macOS | Python.orgThe official home of the Python Programming Languagehttps://www.python.org/downloads/macos/

python3 --version
Python 3.9.13

 2. Installation Cython

pip3 install cython --no-use-pep517

pip3 install cython --no-use-pep517
Collecting cython
  Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Installing collected packages: cython
Successfully installed cython-0.29.32
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command.

3. Install numpy

pip3 install numpy --no-use-pep517

pip3 install numpy --no-use-pep517
Collecting numpy
  Downloading numpy-1.23.3-cp39-cp39-macosx_11_0_arm64.whl (13.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.4/13.4 MB 220.8 kB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-1.23.3
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command.

4. Install pandas

pip3 install pandas --no-use-pep517

pip3 install pandas --no-use-pep517
Collecting pandas
  Downloading pandas-1.5.0-cp39-cp39-macosx_11_0_arm64.whl (10.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 217.1 kB/s eta 0:00:00
Collecting pytz>=2020.1
  Using cached pytz-2022.2.1-py2.py3-none-any.whl (500 kB)
Requirement already satisfied: numpy>=1.20.3 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pandas) (1.23.3)
Collecting python-dateutil>=2.8.1
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting six>=1.5
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pytz, six, python-dateutil, pandas
Successfully installed pandas-1.5.0 python-dateutil-2.8.2 pytz-2022.2.1 six-1.16.0
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command.

Supongo que te gusta

Origin blog.csdn.net/guo_zhen_qian/article/details/127071584
Recomendado
Clasificación