如何在 Raspberry Pi 4 B 上安装 matplotlib?
我想知道是否有人知道为什么我无法在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论