打算在香蕉派(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安装方式搞定了,懒得深究上述错误啦。
相关链接
- Failed to build v1.17.0 on CentOS7 with default gcc (4.8) #14147
- Installing Numpy using pip3 on Ubuntu - Error “Command failed with exit status 1”
https://steemit.com/~witnesses type in
oflyhigh
and click VOTE
Vote @oflyhigh via Steemconnect
Thank you!
!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.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit