LoginSignup
8
8

More than 5 years have passed since last update.

【Termux】Android上にPython環境を作成する

Last updated at Posted at 2017-12-16

Android端末上でLinux環境が作れるtermuxが面白くて弄ってみたのでそのメモ。
結局numpyがインストールできず若干止まっているのですが、軽いpythonスクリプトくらいなら動かせるので面白いですね。
あとはTaskerと連携可能なようなので可能性を感じます。

下記は実際に使ったログです。
# 端末のストレージにシンボリックリンクを作成
# 内部ストレージやsdカードの利用はここで作ったシンボリックリンクから行う
# 実パスからでは権限不足となってしまう模様
termux-setup-storage

#Git
apt install git

#Vim
apt install vim

# 設定
set fileencodings=utf-8,sjis
set fileencodings=utf-8
set encoding=utf-8
# 参考
https://sites.google.com/site/fudist/Home/qfixhowm/other-service/howm-android\#TOC-Termux
# ソフトウェアキーボード利用時でもHacker's Keyboardを使えばEscキーが使えるのでなんとかなる

#Python3
#内部的にはCythonをインポートしている模様
apt install python

# ライブラリのインポートはpipが使える
pip install xxx

# Python mysql-connectorのインポート
# 下記サイトと同じくpipでインストールできない..
https://qiita.com/a_t_a/items/680ed657c4dbeab40a28
# zipをブラウザでDLし、解凍してインストールすればOK
python setup.py install

# numpy
# 結局インストールできず...
# 下記サイトなどを参考
https://github.com/termux/termux-packages/issues/1737
https://plus.google.com/+NaganumaTatsumi/posts/inz3nrEau2b
http://hibagon.sblo.jp/s/article/181186800.html

# 必要と思われるライブラリ
apt install python-dev fftw
pip install wheel
apt install clang libc++
pip install numpy==1.9.1
# 自分ではこれではインストール出来ず...
LDFLAGS=" -lm -lcompiler_rt" pip install numpy

# matplotlib
apt install freetype-dev libpng-dev
apt install pkg-config

8
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8