Python Nutter Posts: n/a
#1: Nov 4 '08
Mini install guide for python on the iPhone:
Cydia =Install SSH helps make initial configuration easier until you
get used to MobileTerminal
Cydia =Install MobileTerminal (closest to a bash shell you get on
your iPhone currently)
Cydia =Install Finder (graphical alternative to using
SSH/MobileTerminal for setting permissions, navigating file system,
moving/copying files, etc.)
Cydia =Install Python (currently installs CPython 2.5.1)
Cydia =Install PyObjC (this is your hook into iPhone API)
Cydia =Install Setuptools (currently install 0.6c7)
Cydia =Install iPhone/Python (examples, the hello world is a PyObjC
call into the iPhone API to load and scroll the contacts list in the
phone)
Not much left to have a fast running python implementation in your
pocket except IMHO ipython. Now that you have Setuptools installed,
you can run easy_install directly on your iPhone and download iPython
over the air.
The iPhone OS X architecture is of course a BSD Unix Userland
environment so you should feel right at home.
The two accounts, root and mobile both share the same default password
'alpine'. So once you setup your phone I recommend you change the
password for each account right away just to secure your phone a
little more. Root you won't need, Mobile is what the default account
is on the current iPhone OS implementation for the standard user
(you).
Easiest way to access your phone is SSH from your Mac, Linux, or
Windows box. (or just use MobileTerminal.app on the iphone directly
keeping in mind you will default to the mobile account in the shell)
Simply join your iPhone over wifi to your wireless access point or
ad-hoc-network, and display your iPhone's ip address. Now you are
ready to ssh into it.
$ssh root@<your iphones ip address>
password: alpine
$chpass
<change your password for root>
while you are here might as well install ipython
$easy_install ipython
$exit
now same for mobile
$ssh root@<your iphone ip address>
password: alpine
$chpass
<change your password for mobile>
$ipython
<test your ipython if it loads, yes? good. now just exit()>
$cd .ipython
$nano ipy_user_conf.py
<or vi or emac or whatever you like, its easier for beginners to try nano>
CTRL+W (find)
Where: #import ipy_editors
<Now for those who are following along using MobileTerminal.app here
is a quick guesture routine
Single Tap screen to bring up a quick tap box grid of common unix
commands that get pasted when selected into the shell
Double Tap screen to hide the onscreen keyboard and see the full screen.
Drag Top left downward diagonally to right for CTRL
Drag Top right downward diagonally to left for TAB -- good for tab
completion in the bash shell
<ok back to editing ipy_user_conf.py>
Delete the # comment character
Scroll down <MobileTerminal.app users just drag up, down, left, or
right quickly for cursor movement>
Add your new line below the text "# Or roll your own"
ipy_editors.install_editors("nano +$line $file")
CTRL+X (exit)
Y to save
Now test your ipython link to nano editor
$ipython
In [1]: edit test.py
<nano should now launch and you can edit your python script on your
iPhone directly, when you save it, iPython will execute the python
code>
In [2]: exit()
$cat test.py
<your code should display, good now we are done>
$rm test.py <remove our test file>
Its up to you where you want to save your python scripts. I would
suggest in Documents under your account (mobile).
<for example launch MobileTermina.app>
$cd ~
$cd D* <or just D and try the tab completion gesture Top right
drag diagonally down to left>
$mkdir python <or whatever you want to call your directory>
What is missing? Tkinter, iPhone uses its own API, Desktop Manager
(Springboard), etc.
What is different? PyObjC, this is where you get to use those iPhone
API calls from within your python script on the iPhone including GUI
API calls.
Now you have Python in your Pocket that you can take anywhere and whip
it out anytime the Python bug hits you and you want to work on some
code.
You can use SSH to move/copy/sync your files to your desktop.
Or other ways: AirSharing app over wifi, etc.
I'll be giving iPhone Python 2.5.1 a workout on on of Mark Lutz's
books and report any more gotchas that I come across.
Cheers,
PN
分享到:
相关推荐
在Python编程语言中,获取iPhone或其他移动设备的型号信息是一项常见的任务,特别是在自动化测试、数据分析或者设备特定功能开发时。本篇文章将详细讲解如何通过Python实现这一目标。 首先,我们需要理解的是,...
Python Programming on Win32 <br> Mark Hammond Andy Robinson Publisher: O'Reilly <br>ISBN: 1-56592-621-8, 672 pages
《Python编程在Win32平台》是一本专为在Windows环境下使用Python进行开发的程序员编写的指南。本书由Mark Hammond和Andy Robinson合作撰写,详细介绍了如何利用Python的强大功能与Windows操作系统进行深度集成。 ...
The purpose of this book is to show you how to write Python programs in good idiomatic Python 3 style, and to be a useful reference for the Python 3 language after the initial reading. Although Python...
标题“iphone python console”指的是一个特别为iOS设备设计的Python控制台程序,它允许用户在iPhone上编写和执行Python代码。这个程序可能是为了方便开发者在移动设备上进行快速原型开发,测试代码,或者进行轻量级...
Python Programming on Win32 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者...
本篇文章将探讨如何使用Python来轻松地区分Objective-C和Swift环境下运行的iPhone模型。 首先,Objective-C是苹果早期推出的面向对象的语言,广泛应用于iOS和Mac OS X的开发。Swift则是在2014年苹果发布的新一代...
CNTK for Python on Windows, with GPU. (3/4)
CNTK for Python on Windows, with GPU. (4/4)
Hands-On Enterprise Automation with Python: Automate common administrative and security tasks with the most popular language Python Invent your own Python scripts to automate your infrastructure Hands...
Sections on regression analysis methodology will help you to value assets and understand the relationship between commodity prices and business stocks. In addition to this, you'll be able to forecast...
If you are a Python developer who wants to enter the world of blockchain, Hands-On Blockchain for Python Developers is for you. The book will be your go-to guide to becoming well-versed with the ...
Hands On Machine Learning with Python by John Anderson English | 6 Aug. 2018 | ISBN: 1724731963 | 224 Pages | EPUB | 2.22 MB
Hands-On Data Science and Python Machine Learning by Frank Kane English | 31 July 2017 | ISBN: 1787280748 | ASIN: B072QBVXGH | 420 Pages | AZW3 | 7.21 MB Key Features Take your first steps in the ...
资源分类:Python库 所属语言:Python 资源全名:oncall-1.3.4-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Hands-On Enterprise Automation with Python: Automate common administrative and security tasks with the most popular language Python Invent your own Python scripts to automate your infrastructure Hands...
CNTK for Python on Windows, with GPU. (2/4)
Add Python to the search path on Windows
external Python packages, which is good to know when the “batteries included” with Python don’t fit your application. And it’s fun to try something new. I also include some examples of what not to...