<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          python移植到arm平臺(tái)

          作者: 時(shí)間:2016-11-09 來(lái)源:網(wǎng)絡(luò) 收藏
          1. 交叉編譯Python

            見(jiàn)Cross Compiling Python for Embedded Linux

          本文引用地址:http://www.ex-cimer.com/article/201611/317666.htm
          CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=arm-linux-ranlib ./configure --host=arm-linux --build=x86_64-linux-gnu --prefix=/root/tftpboot/Python-2.7.3make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnumake install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes prefix=/root/tftpboot/Python-2.7.3

          2. PC與開(kāi)發(fā)板文件傳輸

            tftp: tftp -l path/to/filename -r filename -g 192.168.*.*

          3. 文件拷貝

          •   cp /your/path/bin/python2.7 /bin/python

          or export PATH=/your/path/bin/:$PATH # OK210開(kāi)發(fā)板會(huì)報(bào)錯(cuò)

          • 拷貝serial、django等python庫(kù)拷貝到/lib/python2.7/site-packages/目錄下。

          4. 設(shè)置Python相關(guān)環(huán)境變量

            以Python2.7.x為例。

          export PYTHONHOME=/your/path/#export PYTHONPATH=$PYTHONHOME:$PYTHONHOME/lib/python2.7:$PYTHONHOME/lib:$PYTHONHOME/lib/python2.7/site-packages#export PATH=$PATH:$PYTHONHOME:$PYTHONPATH

          5. sqlite3

          Building SQLLite and other dependanciesThanks to Lothsahn’s 2.7.3 patch, it is now possible to build sqlite3, bz2, gz, ssl and ctypes.  Lothsahn provides the following instructions:To do the compilation, the dependencies must be in the include and lib folder one path up from the python install.   For example:/include <– header files go here/lib <– shared object files go here/Python-2.7.3 <—Python sources go here during compileDependencies include libffi, sqlite, openssl, bzip2, zlib, etc.

          1. 按照上面Paul Gibson給的Cross Compiling Python for Embedded Linux, 但是import sqlite3會(huì)報(bào)錯(cuò),原因暫不明。

          試了一些解決辦法,嘗試未果,可能是lib_dir路徑問(wèn)題:

          •   Removing other search paths from the setup.py, but the one i had the ARM compiled library in, made it work. 測(cè)試也未通過(guò)。

          http://stackoverflow.com/questions/12385634/shared-library-sqlite3-so-not-found-when-importing-sqlite3-on-python-2-6-6

          •   http://stackoverflow.com/questions/10654707/no-module-named-zlib-found
          •   http://stackoverflow.com/questions/6171210/building-python-and-more-on-missing-modules

          3.debian平臺(tái)成功。 http://www.friendlyarm.net/forum/topic/2731

          參考:

          1. cross compile python, busybox, flex, bash and so on,ARM cross-compiling howto

          2. 網(wǎng)上一個(gè)給力的例子,python-2.6.6:

          ClickandrunpythoncrosscompilingforEmbeddedARMLinux

          3.在友善之臂Linux系統(tǒng)中使用pythonhttp://112.124.9.243/?p=285

          4.移植python3到ARM平臺(tái)的OK6410開(kāi)發(fā)板http://www.51bigfool.com/%E7%A7%BB%E6%A4%8Dpython3%E5%88%B0arm%E5%B9%B3%E5%8F%B0%E7%9A%84ok6410%E5%BC%80%E5%8F%91%E6%9D%BF.html

          附:

          •  用strip處理過(guò)后,將去掉其中的調(diào)試信息,執(zhí)行文件大小也將小很多。命令如下:
              #arm-linux-strip file
              其中file是用arm-liunux-gcc編譯生成的二進(jìn)制文件。
          • ./configure--host=arm-linux CC=arm-linux-gcc AR=arm-linux-ar STRIP=arm-linux-strip RANLIB=arm-linux-ranlib
          • sqlite3的交叉編譯
            •   # CC=arm-linux-gcc ./configure --prefix=/your/path/sqlite-3.7.14 --host=arm-linux --disable-tcl

                #make && make install




          關(guān)鍵詞: python移植arm平

          評(píng)論


          技術(shù)專(zhuān)區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();