Python 移植教程

Python 移植到arm的教程python

使用的源文件須要自行從網上下載。linux

 準備文件:web

 

Python-2.7.13.tgzsql

sqlite-autoconf-3200100.tar.gz網絡

Python-2.7.13-xcompile.patch.tar.gzpython2.7

 

————————————————工具

步驟一、準備環境ui

 

tar xvf Python-2.7.13.tgz3d

 

tar xvf sqlite-autoconf-3200100.tar.gzsqlite

 

mkdir python2_7_13_for_x86_32

 

mkdir python2_7_13_for_arm

 

mkdir INSTALL

 

mkdir sqlite3

 

————————————————

步驟二、安裝sqlite

 

cd sqlite-autoconf-3200100

 

./configure --host=arm-arago-linux-gnueabi \

    --prefix=$PWD/../sqlite3

 

make

make install

 

————————————————

步驟三、安裝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

 

————————————————

步驟四、打補丁

 

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

 

————————————————

步驟五、配置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"

 

 

————————————————

步驟六、編譯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

 

————————————————

步驟七、安裝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

 

————————————————

步驟八、移植到開發板以後的配置

 

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工具

 

————————————————

步驟一、下載setuptools-0.6c11-py2.7.egg

 

wget https://pypi.python.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea

 

————————————————

步驟二、安裝easy_install

 

 

/bin/sh setuptools-0.6c11-py2.7.egg

 

————————————————————————————————————————————

########################################################################################

————————————————————————————————————————————

 

修改openssl.so庫的版本

 

————————————————

步驟一、下載openssl-OpenSSL_1_0_1b.zip,並解壓縮

 

tar xvf openssl-OpenSSL_1_0_1b.zip

 

————————————————

步驟二、

 

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/

 

————————————————

步驟三、在開發板上進行操做

 

mv /media/mmcblk1p1/arm_install.tar /

 

tar xvf arm_install.tar

 

cp -r /arm_install/lib/* /usr/lib

 

cp /arm_install/bin/* /usr/bin/

 

————————————————

步驟四、取消SSL全局驗證並驗證easy_install

 

vi /INSTALL/bin/easy_install

 

增長

 

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

 

 

easy_install web.py

————————————————

步驟五、安裝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

但願你看了個人文章有所收穫。(多多點贊,多多關注,有用就頂一下!)

相關文章
相關標籤/搜索