移植python2.7.3到arm linux
2016-09-22 10:51
453 查看
1.本文链接地址
http://blog.csdn.net/lz_obj/article/details/52620276
2.环境
linux系统版本:Ubuntu 10.04
交叉编译工具:arm-linux-gcc4.5.2
嵌入式linux内核版本:Linux 2.6
3.操作步骤
(1)下载源码包Python-2.7.3.tgz和补丁Python-2.7.3-xcompile.patch,https://www.python.org/download/releases/2.7.3/
(2)将这两个文件放入/home/中,解压压缩包tar -xvzf Python-2.7.3.tgz,把补丁移动到Python-2.7.3/中,mv Python-2.7.3-xcompile.patch Python-2.7.3/,进入解压后的文件夹中cd Python-2.7.3
(3) 运行配置文件./configure
(4)make python Parser/pgen
(5)相应文件改名mv python hostpython,mv Parser/pgen Parser/hostpgen
(6)清理操作 make distclean
(7)打补丁patch -p1 < Python-2.7.3-xcompile.patch
(8)设置参数
CC=arm-none-linux-gnueabi-gcc
CXX=arm-none-linux-gnueabi-g++
AR=arm-none-linux-gnueabi-ar
RANLIB=arm-none-linux-gnueabi-ranlib
/* 此处设置根据个人情况,可与9运行配置文件一并执行 */
(9)修改setup.py
/*
说明:此处涉及python 调用sqlite3接口 参考 http://www.cnblogs.com/hit-python/articles/4081673.html 详细操作可以查看这篇文章,写的很详细,
我的sqlite3(arm linux)是之前编译好的,整个文件夹(包括bin/ lib/ ...),路径为/home/sqlite3_armlinux
*/
做如下修改
![](https://img-blog.csdn.net/20160922113835280?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
修改为:sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/include' ]
sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/include' ]
![](https://img-blog.csdn.net/20160922114154704?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
修改为:sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/lib' ]
sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/lib' ]
保存setup.py修改,运行配置文件 ./configure--host=arm-none-linux-gnueabi --prefix=/python
(10)make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgenBLDSHARED="arm-none-linux-gnueabi-gcc -shared"CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yes
(11)make install HOSTPYTHON=./hostpython BLDSHARED="arm-none-linux-gnueabi-gcc-shared" CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yesprefix=/home/Python-2.7.3/_install
/* 10.11此处一些设置根据个人情况 */
(12)将_install文件夹移动到开发板中
4.运行截图
![](https://img-blog.csdn.net/20160922113729410?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
5.参考资料
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html http://www.cnx-software.com/2011/02/04/cross-compiling-python-for-mips-and-arm-platforms/ http://www.cnblogs.com/hit-python/articles/4081673.html
http://blog.csdn.net/lz_obj/article/details/52620276
2.环境
linux系统版本:Ubuntu 10.04
交叉编译工具:arm-linux-gcc4.5.2
嵌入式linux内核版本:Linux 2.6
3.操作步骤
(1)下载源码包Python-2.7.3.tgz和补丁Python-2.7.3-xcompile.patch,https://www.python.org/download/releases/2.7.3/
(2)将这两个文件放入/home/中,解压压缩包tar -xvzf Python-2.7.3.tgz,把补丁移动到Python-2.7.3/中,mv Python-2.7.3-xcompile.patch Python-2.7.3/,进入解压后的文件夹中cd Python-2.7.3
(3) 运行配置文件./configure
(4)make python Parser/pgen
(5)相应文件改名mv python hostpython,mv Parser/pgen Parser/hostpgen
(6)清理操作 make distclean
(7)打补丁patch -p1 < Python-2.7.3-xcompile.patch
(8)设置参数
CC=arm-none-linux-gnueabi-gcc
CXX=arm-none-linux-gnueabi-g++
AR=arm-none-linux-gnueabi-ar
RANLIB=arm-none-linux-gnueabi-ranlib
/* 此处设置根据个人情况,可与9运行配置文件一并执行 */
(9)修改setup.py
/*
说明:此处涉及python 调用sqlite3接口 参考 http://www.cnblogs.com/hit-python/articles/4081673.html 详细操作可以查看这篇文章,写的很详细,
我的sqlite3(arm linux)是之前编译好的,整个文件夹(包括bin/ lib/ ...),路径为/home/sqlite3_armlinux
*/
做如下修改
修改为:sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/include' ]
sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/include' ]
修改为:sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/lib' ]
sqlite_inc_paths = ['/home/sqlite3_armlinux' + '/lib' ]
保存setup.py修改,运行配置文件 ./configure--host=arm-none-linux-gnueabi --prefix=/python
(10)make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgenBLDSHARED="arm-none-linux-gnueabi-gcc -shared"CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yes
(11)make install HOSTPYTHON=./hostpython BLDSHARED="arm-none-linux-gnueabi-gcc-shared" CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yesprefix=/home/Python-2.7.3/_install
/* 10.11此处一些设置根据个人情况 */
(12)将_install文件夹移动到开发板中
4.运行截图
5.参考资料
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html http://www.cnx-software.com/2011/02/04/cross-compiling-python-for-mips-and-arm-platforms/ http://www.cnblogs.com/hit-python/articles/4081673.html
相关文章推荐
- 移植python2.7.3到arm linux
- arm-linux-gcc-4.4.3交叉编译python2.7.3并移植到ARM
- ubuntu14.04交叉编译移植python2.7.3
- 【引用】Linux应用程序开发(三)---移植kvm到arm linux
- 移植appweb+php5+sqlite3到ARM LINUX
- arm linux串口蓝牙工具移植及使用【转】
- Python函数代码移植
- Python2.7.3移除字符串中重复字符(二)
- C#开源爬虫NCrawler源代码解读以及将其移植到python3.2(4)
- 20130704 移植apache2到arm Linux上
- 使用2to3将代码移植到Python 3
- python移植到arm的单板
- 将Open SSH Server 移植到ARM Linux成功
- arm linux下实现ntp移植(2018.3.8亲测成功)
- 移植python到嵌入式linux上并添加json库
- Bluez交叉编译移植到arm linux
- centos6.3 安装python2.7.3
- 将Open SSH Server 移植到ARM Linux成功
- Python2.7.3移除字符串中重复字符(一)
- Python2.7.3读取日志信息时发生读取不完整的问题