本篇内容介绍了“Python移植到arm的教程”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
Python 移植到arm的教程
使用的源文件需要自行从网上下载。
准备文件:
Python-2.7.13.tgz
sqlite-autoconf-3200100.tar.gz
Python-2.7.13-xcompile.patch.tar.gz
————————————————
步骤1、准备环境
tar xvf Python-2.7.13.tgz
tar xvf sqlite-autoconf-3200100.tar.gz
mkdir python2_7_13_for_x86_32
mkdir python2_7_13_for_arm
mkdir INSTALL
mkdir sqlite3
————————————————
步骤2、安装sqlite
cd sqlite-autoconf-3200100
./configure --host=arm-arago-linux-gnueabi \
--prefix=$PWD/../sqlite3
make
make install
————————————————
步骤3、安装python2_7_13_for_x86_32
cd ../python2_7_13_for_x86_32/
sed -i 's/self.extensions.remove(ext)/print(ext.name)/g' ../Python-2.7.13/setup.py
../Python-2.7.13/configure --prefix=`pwd`
make
make install
————————————————
步骤4、打补丁
cd ..
tar xvf Python-2.7.13-xcompile.patch.tar.gz -C Python-2.7.13
cd Python-2.7.13/
patch -p1 < Python-2.7.13-xcompile.patch
————————————————
步骤5、配置python2_7_13_for_arm
cd ../python2_7_13_for_arm/
../Python-2.7.13/configure --prefix=`pwd` \
--host=arm-arago-linux-gnueabi \
--build=i686-linux-gnu \
--enable-ipv6 \
--enable-static \
ac_cv_file__dev_ptmx="yes" \
ac_cv_file__dev_ptc="no" \
LDFLAGS="-L$PWD/../sqlite3/lib" \
CPPFLAGS="-I$PWD/../sqlite3/include"
————————————————
步骤6、编译python2_7_13_for_arm
make HOSTPYTHON=../python2_7_13_for_x86_64/python \
HOSTPGEN=../python2_7_13_for_x86_64/Parser/pgen \
BLDSHARED="arm-arago-linux-gnueabi-gcc -shared" \
CROSS_COMPILE=arm-arago-linux-gnueabi- \
CROSS_COMPILE_TARGET=yes \
HOSTARCH=arm-arago-linux-gnueabi \
BUILDARCH=i686-linux-gnu
————————————————
步骤7、安装python2_7_13_for_arm
make install HOSTPYTHON=../python2_7_13_for_x86_64/python \
BLDSHARED="arm-arago-linux-gnueabi-gcc -shared" \
CROSS_COMPILE=arm-arago-linux-gnueabi- \
CROSS_COMPILE_TARGET=yes \
prefix=$PWD/../INSTALL
————————————————
步骤8、移植到开发板之后的配置
export PATH=/INSTALL/bin:$PATH
python python2.7-config --prefix /INSTALL
python python2.7-config --includes /INSTALL/include/
python python2.7-config --libs /INSTALL/lib/
————————————————————————————————————————————
########################################################################################
————————————————————————————————————————————
为Python安装easy_install工具
————————————————
步骤1、下载setuptools-0.6c11-py2.7.egg
wget https://pypi.python.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
————————————————
步骤2、安装easy_install
/bin/sh setuptools-0.6c11-py2.7.egg
————————————————————————————————————————————
########################################################################################
————————————————————————————————————————————
修改openssl.so库的版本
————————————————
步骤1、下载openssl-OpenSSL_1_0_1b.zip,并解压缩
tar xvf openssl-OpenSSL_1_0_1b.zip
————————————————
步骤2、
mkdir arm_install
CC=arm-arago-linux-gnueabi-gcc
./Configure linux-elf no-asm --prefix=$PWD/arm_install --openssldir=$PWD --cross-compile-prefix=arm-arago-linux-gnueabi- shared
make
make install
tar cvf arm_install.tar arm_install/
mv arm_install.tar /media/BOOT/
————————————————
步骤3、在开发板上进行操作
mv /media/mmcblk1p1/arm_install.tar /
tar xvf arm_install.tar
cp -r /arm_install/lib/* /usr/lib
cp /arm_install/bin/* /usr/bin/
————————————————
步骤4、取消SSL全局验证并验证easy_install
vi /INSTALL/bin/easy_install
增加
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
easy_install web.py
————————————————
步骤5、安装pip工具
easy_install pip
//此时使用pip工具会报SSL 认证错误,需要安装ntp网络对时
————————————————————————————————————————————
########################################################################################
————————————————————————————————————————————
移植ntp网络对时 (335x已有不用移植)
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz
tar xvf ntp-4.2.8p10.tar.gz
cd ntp-4.2.8p10/
mkdir arm_install
CC=arm-arago-linux-gnueabi-gcc
./configure --prefix=$PWD/arm_install --host=arm-arago-linux-gnueabi --enable-static --with-yielding-select=yes
make
make install
--------------------------------------
./ntpdate time.buptnet.edu.cn
“Python移植到arm的教程”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。