首先去python官网获取源码,我这里使用的是python3.8.9版本。 如果开发环境上预先没有python3.8的版本,则需要编译3.8的X86版本. forlinx@ubuntu:~$
cd Python-3.8.9/ forlinx@ubuntu:~/Python-3.8.9$
mkdir build.pc forlinx@ubuntu:~/Python-3.8.9$
cd build.pc/ forlinx@ubuntu:~/Python-3.8.9/build.pc$
../configure --enable-optimizations forlinx@ubuntu:~/Python-3.8.9/build.pc$ make forlinx@ubuntu:~/Python-3.8.9/build.pc$ sudo ln -s /home/forlinx/Python-3.8.9/build.pc/python
/usr/bin/python forlinx@ubuntu:~/Python-3.8.9/build.pc$
python Python 3.8.9 (default, Dec 19 2022, 13:49:18) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or
"license" for more information. >>> 交叉编译 forlinx@ubuntu:~/Python-3.8.9$ mkdir build.arm forlinx@ubuntu:~/Python-3.8.9$ cd build.arm/ forlinx@ubuntu:~/Python-3.8.9/build.arm$ .
/opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux forlinx@ubuntu:~/Python-3.8.9/build.arm$
../configure \ --prefix=/home/forlinx/Python-3.8.9/mylib
\ --build=x86_64-linux \ --host=aarch64-poky-linux
\ --target=aarch64-poky-linux
\ --enable-shared \ --enable-ipv6 \ --with-system-ffi \ ac_cv_file__dev_ptmx=0
\ ac_cv_file__dev_ptc=0
\ --enable-optimizations forlinx@ubuntu:~/Python-3.8.9/build.arm$
make forlinx@ubuntu:~/Python-3.8.9/build.arm$
make install forlinx@ubuntu:~/Python-3.8.9$
tar -cvf mylib.tar.bz2 ./mylib 打包好之后将压缩包拷贝到开发板中进行解压 root@okmx8mm:~#
tar -vxf mylib.tar.bz2 直接运行会报缺少库的错误 解决方法 root@okmx8mm:~/mylib#
cp ./lib/libpython3.8.so.1.0 /usr/lib 再去运行就可以正常运行了 |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-22 04:51
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.