linux 下编译python

1. 下载Python源代码

到 https://www.python.org/ftp/python/ 上下载与电脑对应版本的Python

2. 编译

执行下列命令编译安装
--prefix设置安装的位置,便于管理

./configure --host=arm-linux --build=arm-linux-gnueabihf ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no --disable-ipv6 --prefix=/home/apps/python3

host与本机的arm库路径名称一致

2.1. 编译中遇到的错误

  1. 遇到错误configure: error: readelf for the host is required for cross builds
    看样子是缺少readelf这个文件
    在arm-gcc的bin目录下发现一个arm-linux-gnueabihf-readelf,在此目录执行
ln -s arm-linux-gnueabihf-readelf arm-linux-readelf

 

  1. 遇到错误Fatal: You must get working getaddrinfo() function. or you can specify "--disable-ipv6".
    因为用不到IPv6,所以在configure后面加上--disable-ipv6

  2. configure: error: set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling
    在configure后面加上ac_cv_file__dev_ptmx=no即可

  3. configure: error: set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling
    同样加上ac_cv_file__dev_ptc=no

  4. configure: error: cannot run C compiled programs. If you meant to cross compile, use '--host'.
    交叉编译需要设置--host--build两个参数



作者:uenigma
链接:https://www.jianshu.com/p/7346cc4e41ac
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
 
当在arm机器上,使用python调用出现Illegal instruction(core dumped)时,将numpy从1.19.5降级至1.19.4,可能可以解决问题
posted @   鸭子船长  阅读(1407)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2021-04-12 CPU中的cache结构以及cache一致性(转)
2017-04-12 jni——如何转换有符号与无符号数
2017-04-12 java数据类型是有符号的,那与有些无符号的如何区别
点击右上角即可分享
微信分享提示