在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(我是更具下面的调试信息找到问题原因的)。
- stat64("/work/rootfs/work/python/lib/python2.6/lib-old", 0xbea14690) = -1 ENOENT (No such file or directory)
-
stat64("/work/rootfs/work/python/lib/python2.6", 0xbea14690) = -1 ENOENT (No such file or directory)
-
stat64("/work/rootfs/work/python/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
-
stat64("/work/rootfs/work/python/lib/python2.6/lib-old", 0xbea146c8) = -1 ENOENT (No such file or directory)
-
stat64("/work/rootfs/work/python/lib/python2.6/lib-dynload", 0xbea14690) = -1 ENOENT (No such file or directory)
-
stat64("/work/rootfs/work/python/lib/python2.6", 0xbea14690) = -1 ENOENT (No such file or directory)
-
stat64("/work/rootfs/work/python/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
-
stat64("/work/rootfs/work/python/lib/python2.6/lib-dynload", 0xbea146c8) = -1 ENOENT (No such file or directory)
-
write(2, "\'import site\' failed; use -v for"..., 43'import site' failed; use -v for traceback
阅读(8475) | 评论(0) | 转发(0) |