M1 Mac 上的 Pip 安装 matplotlib 失败 [英] Pip install matplotlib fails on M1 Mac

查看:103
本文介绍了M1 Mac 上的 Pip 安装 matplotlib 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过M1 Mac上的pip安装matplotlib时遇到困难.我通过Homebrew安装了Python 3.9.1.

I'm having difficulties installing matplotlib through pip on my M1 Mac. I have Python 3.9.1 installed through Homebrew.

运行 pip3 install matplotlib 时,安装程​​序会尝试安装最新版本 matplotlib 3.3.4.安装程序卡住并在一段时间后打印一条巨大的错误消息.在此之后,它尝试安装 3.3.3 版,然后再次发生同样的情况,依此类推.出了什么问题?

When running pip3 install matplotlib the installer tries installing the newest version, matplotlib 3.3.4. The installer gets stuck and prints a huge error message after some time. After this it tries installing version 3.3.3 after which the same happens again, and so on. What goes wrong?

以下是一些错误消息:

    william@Williams-MacBook-Pro ~ % pip3 install matplotlib
Collecting matplotlib
  Using cached matplotlib-3.3.4.tar.gz (37.9 MB)
    ERROR: Command errored out with exit status 1:
     command: /opt/homebrew/opt/python@3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-install-h7oltt2f/matplotlib_1ad1e28a38b14b40ae2bcaa7f9b01cab/setup.py'"'"'; __file__='"'"'/private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-install-h7oltt2f/matplotlib_1ad1e28a38b14b40ae2bcaa7f9b01cab/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-pip-egg-info-0jjax4jc
         cwd: /private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-install-h7oltt2f/matplotlib_1ad1e28a38b14b40ae2bcaa7f9b01cab/
    Complete output (2287 lines):
      ERROR: Command errored out with exit status 1:
       command: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/tmp3p0is_vc
           cwd: /private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-wheel-5rqmhbah/numpy_cefeff1e3acc4faea4c06d0f4597b2da

推荐答案

python3 -m pip install cython   
python3 -m pip install --no-binary :all: --no-use-pep517 numpy
brew install libjpeg
python3 -m pip install matplotlib

为我工作,此时它安装了numpy 1.20.1.

Worked for me, at this time it installed numpy 1.20.1.

Homebrew的Python版本相同(3.9.1).

Same Python version (3.9.1) from Homebrew.

这篇关于M1 Mac 上的 Pip 安装 matplotlib 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆