如何在 Raspberry Pi 4 B 上安装 matplotlib?

发布于 2025-01-15 16:51:07 字数 1842 浏览 0 评论 0原文

我想知道是否有人知道为什么我无法在 RPi 4B 上安装 matplotlib 版本 3.3.4。我正在运行 Ubuntu 20.04.1 LTS 和 Python 3.6.13。这是我尝试过的:

pip install matplotlib==3.3.4

但是,我收到一堆红色文本,其中有一条错误告诉我它无法构建轮子。这是错误输出:

  /usr/bin/ld: /tmp/_backend_agg.cpython-36m-aarch64-linux-gnu.so.BXBFax.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /tmp/_backend_agg.cpython-36m-aarch64-linux-gnu.so.BXBFax.ltrans0.ltrans.o(.text+0x3fc): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
  /usr/bin/ld: final link failed: bad value
  collect2: error: ld returned 1 exit status
  error: command 'aarch64-linux-gnu-g++' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for matplotlib
  Running setup.py clean for matplotlib
Failed to build matplotlib
Installing collected packages: matplotlib
    Running setup.py install for matplotlib ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yhqnk_yg/matplotlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-yhqnk_yg/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d9f_68ud/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/matplotlib
         cwd: /tmp/pip-install-yhqnk_yg/matplotlib/ 

似乎某个依赖项的编译存在问题,但我不确定如何解决此问题,或者这是否只是我的特定操作系统的问题。我已经在互联网上进行了详尽的搜索以寻求解决方案,但似乎没有人遇到与我相同的问题。

I'm wondering if anyone might know why I'm unable to install matplotlib version 3.3.4 on my RPi 4B. I'm running Ubuntu 20.04.1 LTS with Python 3.6.13. Here is what I tried:

pip install matplotlib==3.3.4

However, I get a bunch of red text with an error telling me it failed to build the wheel. Here is the error output:

  /usr/bin/ld: /tmp/_backend_agg.cpython-36m-aarch64-linux-gnu.so.BXBFax.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /tmp/_backend_agg.cpython-36m-aarch64-linux-gnu.so.BXBFax.ltrans0.ltrans.o(.text+0x3fc): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
  /usr/bin/ld: final link failed: bad value
  collect2: error: ld returned 1 exit status
  error: command 'aarch64-linux-gnu-g++' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for matplotlib
  Running setup.py clean for matplotlib
Failed to build matplotlib
Installing collected packages: matplotlib
    Running setup.py install for matplotlib ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yhqnk_yg/matplotlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-yhqnk_yg/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d9f_68ud/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/matplotlib
         cwd: /tmp/pip-install-yhqnk_yg/matplotlib/ 

It seems like there is an issue with the compilation of one of the dependencies but I'm not sure how to resolve this problem, or if it's just an issue with my specific OS. I've done an exhaustive search of the internet for a solution but it seems no one has had the same problem as me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文