Python 3 on Android using TerminalIDE

I want to encode Python 3 on my Android device. So I went through a Lanky Cyril post about using an IDE terminal to put everything I need to make code on an Android terminal. For Python 2.X, which is installed on the blog, it works like a charm.

So, I installed Python 3 using the same instructions. This is what I get when I try to start Python 3:

terminal++:~$ ~/python3                                                                                                                                              
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Segmentation fault 

I made sure:

export PYTHONHOME=/data/data/com.googlecode.python3forandroid/files/python3
export PYTHONPATH=${PYTHONHOME}/lib/python3.2/lib-dynload

I also checked why python 3 is not loading in StackOverflow.

So the problem might be creating python. Has anyone worked around this?

+4
source share
1

, Python-for-Android (Py4A) script, Python3 "" Android.

3 :

  • "standalone.sh" script, "HOME" (export HOME=/data/data/com.spartacusrex.spartacuside/files), , python.

  • ~/.bashrc :

export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib
$PYTHONHOME/bin/python3 "$@"

, , , Terminal IDE, Python Python.

  • Python , Lanky Cyril, .bashrc:
export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib

, "~/python". :

  #!/system/bin/sh   
  /data/data/com.googlecode.python3forandroid/files/python3/bin/python3 "$@"

, , Terminal IDE, Python. , , Python, .

+2

Source: https://habr.com/ru/post/1529567/


All Articles