Chinaunix首页 | 论坛 | 博客
  • 博客访问: 662253
  • 博文数量: 121
  • 博客积分: 4034
  • 博客等级: 上校
  • 技术积分: 1439
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-28 12:42
文章分类

全部博文(121)

文章存档

2017年(8)

2016年(10)

2013年(2)

2012年(3)

2011年(18)

2010年(80)

分类: Python/Ruby

2011-01-15 01:19:54

在arm上安装python2.6全部过程
1. 平台:
    platform:mini2440
    host system: ubuntu10.10
    target system:Linux mini2440 2.6.29.4
    source:python-2.6.2

2. 编译源码:
  ./configure     \  
    --host=arm-linux    \  
    --prefix=`pwd`/build
   make;make install

3. 安装到arm
(1)将第二步产生的python可执行文件拷贝到arm上,路径为:/work/rootfs/work/python/bin中;
(2)将源码中的Lib文件下的所有文件拷贝到:/work/rootfs/work/python/lib/python2.6中;
(3)将可执行文件python所在的目录添加到环境变量PYTH中:
PATH=/work/rootfs/work/python/bin:${PATH};export PATH
(4)添加一个环境变量,这个是指定python所需要的py文件:
PYTHONHOME=/work/rootfs/work/python/;export PYTHONHOME

4. 移植过程中遇到的问题:
root@mini2440:/work/rootfs/python# python2.6 test.py
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "test.py", line 2, in
    import os
ImportError: No module named os
答案:
在执行的过程中发想所有的python自带的py/pyc库文件找不到,是由于PYTHONHOME指定的路径有问题,和PYTHONHOME下文件架构有问题,一定为:${PYTHONHOME}/lib/python2.6(我是更具下面的调试信息找到问题原因的)。


  1. stat64("/work/rootfs/work/python/lib/python2.6/lib-old", 0xbea14690) = -1 ENOENT (No such file or directory)
  2. stat64("/work/rootfs/work/python/lib/python2.6", 0xbea14690) = -1 ENOENT (No such file or directory)
  3. stat64("/work/rootfs/work/python/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
  4. stat64("/work/rootfs/work/python/lib/python2.6/lib-old", 0xbea146c8) = -1 ENOENT (No such file or directory)
  5. stat64("/work/rootfs/work/python/lib/python2.6/lib-dynload", 0xbea14690) = -1 ENOENT (No such file or directory)
  6. stat64("/work/rootfs/work/python/lib/python2.6", 0xbea14690) = -1 ENOENT (No such file or directory)
  7. stat64("/work/rootfs/work/python/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
  8. stat64("/work/rootfs/work/python/lib/python2.6/lib-dynload", 0xbea146c8) = -1 ENOENT (No such file or directory)
  9. write(2, "\'import site\' failed; use -v for"..., 43'import site' failed; use -v for traceback


阅读(8475) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~