wrjc1hod 发表于 2024-8-17 18:19:59

玩转Termux:教你在手机上安装运行Python!


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">大众</span>好,<span style="color: black;">这儿</span>是 「<a style="color: black;">@手机编程</a>」,我是作者:舞剑,记得「<strong style="color: blue;">关注我</strong>」</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">前面讲解了 Termux 的下载方式以及<span style="color: black;">基本</span>设置,<span style="color: black;">大众</span><span style="color: black;">针对</span>这款神器APP<span style="color: black;">认识</span>的不少,接下来<span style="color: black;">便是</span>喜闻乐见的<span style="color: black;">研发</span>环境安装环节,php、Python、Java……等等。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">有了这些<span style="color: black;">研发</span>环境,Termux<span style="color: black;">才可</span><span style="color: black;">叫作</span>得上是神器。</p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">Python</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Python 是非常适合新手的一款编程语言,入门简单,代码简洁,来<span style="color: black;">瞧瞧</span>怎么安装 Python。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">安装 Python3</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">前面写过,Termux 的安装命令是<strong style="color: blue;">p<span style="color: black;">公斤</span></strong>,打开 APP,直接输入如下命令:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/1379800031da846091632~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=KFqiRexhzPP4UywkqhY9%2FM7wSfY%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">稍等<span style="color: black;">稍许</span>会提示:<strong style="color: blue;"><span style="color: black;">必须</span>下载49M的包,以及292M的手机存储,<span style="color: black;">是不是</span>继续?</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/138570000b7d07786bb22~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=wfaafz2StT2QtdhnrxqOMhONtu4%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">直接输入: <strong style="color: blue;">Y</strong>,回车确认<span style="color: black;">就可</span>。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">再等一会,Python 就安装成功了。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/137400001604d0ffbb28d~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=mdmdSeB7bLqA4K4hTV6LixBoibY%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">按照</span>反馈,安装的 Python 版本为 3.8.5。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">终端输入 <strong style="color: blue;">Python</strong> 试一试是不是真的成功安装了?</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/1385400003dd83c6c787e~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=KWg59FT1rygtEJFhB%2BZN8DTmc%2BM%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">进入了 Python 交互模式,看到一切正常。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">OK,是不是很简单!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">运行 Python</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">运行一个 Python 脚本,有两种<span style="color: black;">办法</span>。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">第1</span>种,直接在 Python 交互模式中编写,但交互<span style="color: black;">更加多</span>用于测试,<span style="color: black;">针对</span>大一点的脚本<span style="color: black;">来讲</span>太不友好了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">第二种,在编辑器中编写 .py 后缀的 Python 脚本,<span style="color: black;">而后</span>在终端输入命令:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/13780000184bbcaa89c23~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=ny%2FCJofjmFI8tRtA2gY26uvRh%2Fg%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">其实还有一种<span style="color: black;">办法</span>,<span style="color: black;">能够</span>用 <strong style="color: blue;">Jupyter</strong>,这是一个很强大 web端 可视化工具,比起单纯的 python 交互模式强大了不止百倍,<span style="color: black;">能够</span>安装许多插件,代码补全等等。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关于 Jupyter,不在今天的讨论范围内,后面再写。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">PIP库安装</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Python 最强大的<span style="color: black;">地区</span><span style="color: black;">便是</span>五花八门的插件库,numpy、requests、lxml……,正是这些现成库的存在,Python才<span style="color: black;">作为</span>最热门<span style="color: black;">亦</span>最容易<span style="color: black;">研发</span>的语言。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">pip 是 Python 官方的包管理工具,用来对 Python 包的安装、卸载、<span style="color: black;">查询</span>,下表介绍了 pip 常用命令:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/138a10000208d4195c35b~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=ASzz69MUn7KUPJW52YHtW2yg%2B7c%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">安装,<span style="color: black;">不消</span>多说了,<span style="color: black;">便是</span>安装包。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">卸载同上。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">查询</span>包,顾名思义,<span style="color: black;">能够</span><span style="color: black;">查询</span>包。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最后一个<span style="color: black;">表示</span>包,则是用来<span style="color: black;">表示</span>包的<span style="color: black;">有些</span>基本信息,例如安装位置<span style="color: black;">或</span>依赖等等。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">话不多说,安装试试。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">lxml包安装</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">lxml,爬虫<span style="color: black;">必须</span>包,用来解析 HTML 或 XML 文档,速度<span style="color: black;">极大</span>,但安装总是出错,百度一搜,都是求助贴。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/1381a0000f7387af3324e~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=IaDMTMQ2QqAkIgav3r%2BxJtO28Ts%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/137dc000245721f049e18~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=i%2BTRt5RAA1d2WkYNTAUvhRDRpt4%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">#</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">太难了!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">别急,我来帮你!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">只<span style="color: black;">必须</span>输入三个命令就行了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">代码如下:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/ff0b0001797f80bfadce~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=mXila6iHJ%2BZ0yxM9i2sfqc4w5Y4%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这是来自基安@Ecodemo的<span style="color: black;">办法</span>,<span style="color: black;">首要</span>安装 libxml2 libxslt,<span style="color: black;">而后</span>再安装 cpython,最后直接安装 lxml</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/1373e000160dc5d14c177~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=sCDnTwj4YgMp%2FHUPJNegqEUtemU%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">亲测成功安装了!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">测试<span style="color: black;">瞧瞧</span>是不是真的成功了,别看着安装了却<span style="color: black;">不可</span>用。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">先进 Python 交互模式,<span style="color: black;">而后</span>输入:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/137e0000129be90f5074a~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=KtMo4v1q0KZQJjJx0AjrxLIKuTc%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">如下所示</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/ff690002ba8bd7219db8~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723894236&amp;x-signature=7GoXXycivQOdztgJkPH5uFPhtEQ%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">无</span>错误,一切正常,说明<span style="color: black;">咱们</span>安装成功了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">PS:</strong>忘记说了,退出Python交互模式的命令是 CTRL+z</p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">后记</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关于 Python 的安装以及 pip包 的<span style="color: black;">运用</span><span style="color: black;">办法</span>大致<span style="color: black;">便是</span>这些,今天就到<span style="color: black;">这儿</span>,<span style="color: black;">更加多</span><span style="color: black;">运用</span><span style="color: black;">办法</span>以及技巧教程后面继续更新,记得关注我!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">另一</span>,新手<span style="color: black;">剧烈</span><span style="color: black;">意见</span><span style="color: black;">运用</span> Pydroid 这款 IDE,<span style="color: black;">优良</span>很大,代码补全,pip安装省心,<span style="color: black;">详细</span>请看<span style="color: black;">文案</span>:「 吊打QPython的集成<span style="color: black;">研发</span>环境,无<span style="color: black;">宣传</span>,无BUG,已完美解锁 」</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">Termux 系列教程:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">1. Termux,跑在Android上的Linux系统,真正的大杀器!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2. Termux系列教程㈠:新手必做的初始化配置!</p>




星☆雨 发表于 2024-8-28 12:47:20

谷歌外链发布 http://www.fok120.com/

j8typz 发表于 2024-9-27 12:05:03

这篇文章真的让我受益匪浅,外链发布感谢分享!

4zhvml8 发表于 2024-10-2 04:43:01

期待你更多的精彩评论,一起交流学习。

4lqedz 发表于 2024-10-27 04:49:41

外贸论坛是我们的,责任是我们的,荣誉是我们的,成就是我们的,辉煌是我们的。

7wu1wm0 发表于 2024-11-12 11:36:48

谷歌网站排名优化 http://www.fok120.com/

qzmjef 发表于 2024-11-13 23:41:48

这篇文章真的让我受益匪浅,外链发布感谢分享!

m5k1umn 发表于 4 天前

i免费外链发布平台 http://www.fok120.com/
页: [1]
查看完整版本: 玩转Termux:教你在手机上安装运行Python!