一、编辑环境及软件版本
host:Ubuntu 16.04 LTS(x64)
target: ZC706(ARMV7)
虚拟机:VMware® Workstation 14 Pro
python版本:3.7.5
编译工具链:arm-linux-gnueabihf-
二、编译
编译Python的嵌入式版需要解释器解析setup.py从而编译Python的模块,因此需要先编译出host的解释器
2.1、编译PC版
./configure --prefix=$(pwd)/mybuild
make
make install
sudo rm /usr/bin/python3
sudo ln -s /home/lzc/develop/Python-3.7.5/mybuild/bin/python3 /usr/bin/python3
python3 -V
2.2、编译arm版
先清除pc编译信息
make clean
make distclean
配置
./configure CC=arm-linux-gnueabihf-gcc CXX=CC=arm-linux-gnueabihf-g++ --host=arm-linux-gnueabihf --build=x86_64-linux-gnu --target=arm-linux-gnueabihf --disable-ipv6 --prefix=$(pwd)/mybuild_arm ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=yes
make
make install
将lib bin share 拷贝到/usr下的对应目录