您好,登錄后才能下訂單哦!
我們首先需要注意的是使用的源文件需要自行從網上下載。
接下來我們來一起嘗試一下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
makeHOSTPYTHON=../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 installHOSTPYTHON=../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
wgethttps://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中。
以上我是在基于sail-imx6q開發板的linux上實現的,小伙伴們也可以在此開發板上檢驗一下。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。