Mac M1芯片安装 Numpy Pandas

本文教你如何简单的在M1芯片的MacBook上安装Numpy和Pandas。

刚入手了一个Mac Pro,是M1芯片的,结果在安装Numpy和Pandas时遇到了各种莫名奇妙的问题

第1种报错,很长,省略了

第2种报错

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

搜各种解决方案,有说安装Miniforge的、有说安装Anaconda的、有说通过Rosetta安装的,更有甚者,说安装tensflow。我靠,我就想装个numpy呀,不至于吧。

下边教你一种简单有效的方法在M1的mac上安装numpy和pandas,话不多说,搞起。

1、升级Python

Mac自带的Python是3.8版本的,我在这上边纠缠了很久,问题都没解决,果断升级到3.9版本

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、安装 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、安装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、安装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.

猜你喜欢

转载自blog.csdn.net/guo_zhen_qian/article/details/127071584