交叉编译Python-3.8.3

源码下载

​wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tar.xz

xz-d Python-3.8.3.tar.xz

tar -xvf Python-3.8.3.tar.xz

cd Python-3.8.3

​


如果PC上预先没有python3.8的版本,则需要编译3.8的PC版本

执行:mkdir build.pc; cd build.pc; ../configure --enable-optimizations; make

将编译的PC版本安装的本地PC,为了不影响PC上原来python的使用,此处直接使用软链接的形式完成安装,ln -s /python3.8 /usr/bin/python(一般而言,python可执行文件位于/usr/bin/目录下)

测试:运行python,结果如下则说明安装成功:

Python 3.8.3 (default, Jun  4 2020, 16:27:05) 
[GCC 6.5.0 20181026] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

交叉编译

mkdir build.arm

../configure \
    --prefix=/Python-3.8.3 \
    --build=aarch64-linux-gnu \
    --host=aarch64-linux \
    --target=aarch64-linux-gnu \
    --enable-shared \
    --enable-ipv6 \
    --with-system-ffi \
    ac_cv_file__dev_ptmx=0 \
    ac_cv_file__dev_ptc=0 \
    --enable-optimizations

make; make install

交叉编译报错

checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for python3.8... no
checking for python3... python3
checking for python interpreter for cross build... configure: error: python3.8 interpreter not found

上面主要报错原因是本地PC上无3.8的python版本,按照步骤2的方法即可解决该问题。

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值