在香蕉派(Banana Pi)M3上安装matplotlib

in #cn5 years ago

打算在香蕉派(Banana Pi)M3上用一下matplotlib,执行安装指令后,出了一大堆错误,安装也没有成功。

安装出错

安装指令如下(virtualenv下):

pip install matplotlib

随便截取一些出错内容:

看提示信息,主要是在编译numpy时候出错。

解决办法

在numpy的官方github上找到一个反应相同问题的issue: Failed to build v1.17.0 on CentOS7 with default gcc (4.8) #14147,其中有人给出这样的解决方案:

CFLAGS=-std=c99 pip install numpy==1.17.0

再看出错提示信息中的部分内容,或许这真的是一个办法呢

numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode

numpy/core/src/npysort/radixsort.c.src:112:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

不过现在最新发行版已经是1.17.2了,另外我觉得C11要比C99新一些,用C11是不是会更好一些呢?于是我将指令修改为:
CFLAGS=-std=c11 pip install numpy==1.17.2

最终果然编译并安装成功(numpy):

Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.17.2

再次执行如下指令:

pip install matplotlib

一切顺利,终于安装成功啦,终于又可以愉快地玩耍啦。

补充

记得以前用如下指令可以直接安装(非virtualenv环境):

sudo apt-get install python3-matplotlib

但是这次尝试,部分文件提示找不到(404 Not Found)

反正pip安装方式搞定了,懒得深究上述错误啦。

相关链接


Vote For Me As Witness
https://steemit.com/~witnesses type in oflyhigh and click VOTE

Vote @oflyhigh via Steemconnect
Thank you!

Sort:  

!thumbup
恭喜你!您的这篇文章入选 @justyy 今日 (2019-09-26) 榜单 【优秀的文章】, 回复本条评论24小时内领赏,点赞本评论将支持 @dailychina 并增加将来您的奖赏。
@justyy 是CN区的见证人,请支持他,给他投票,或者设置justyy为见证人代理。感谢!@justyy的主要贡献:https://steemyy.com

Congratulations! This post has been selected by @justyy as today's (2019-09-26) 【Good Posts】, Steem On! Reply to this message in 24 hours to get rewards. Upvote this comment to support the @dailychina and increase your future rewards! ^_^

SteemIt 工具、API接口、机器人和教程
SteemIt Tools, Bots, APIs and Tutorial



If you believe what I am doing, please consider a spare vote voting me here, thank you very much indeed.

@justyy - the author of https://SteemYY.com and I have been a Steem Witness for more than a year now.

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.01% upvote! Together, let’s change the world!

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.030
BTC 63718.61
ETH 3390.60
USDT 1.00
SBD 2.62