Python 如何在 Android 设备上安装 Jupyter Notebook?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49837474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:16:04  来源:igfitidea点击:

How do I install Jupyter notebook on an Android device?

androidpythonjupytertermux

提问by tel

Is there a way to install a functional instance of Jupyter notebook on an Android device? Specifically, I want to use Jupyter to run a Python notebook.

有没有办法在 Android 设备上安装 Jupyter notebook 的功能实例?具体来说,我想使用 Jupyter 来运行 Python notebook。

采纳答案by tel

I found some information on the web (like in this blog post) while I was coming up with the answer for this question, but it was all at least somewhat wrong and/or out of date. Here's a complete set of working instructions:

当我想出这个问题的答案时,我在网上找到了一些信息(如这篇博文),但至少有些错误和/或过时了。这是一套完整的工作说明:

  1. Install the Termux app.
  2. Open Termux, then enter/run the following commands in the prompt:

    $ apt install clang python fftw libzmq freetype libpng pkg-config libcrypt
    $ LDFLAGS="-lm -lcompiler_rt" pip install jupyter
    
  3. Optionally, you can install some other useful packages that mesh well with Jupyter:

    $ LDFLAGS="-lm -lcompiler_rt" pip install numpy matplotlib
    
  4. Finally, test the notebook out by running:

    $ jupyter notebook
    
  1. 安装Termux 应用程序
  2. 打开 Termux,然后在提示中输入/运行以下命令:

    $ apt install clang python fftw libzmq freetype libpng pkg-config libcrypt
    $ LDFLAGS="-lm -lcompiler_rt" pip install jupyter
    
  3. 或者,您可以安装其他一些与 Jupyter 配合良好的有用软件包:

    $ LDFLAGS="-lm -lcompiler_rt" pip install numpy matplotlib
    
  4. 最后,通过运行来测试笔记本:

    $ jupyter notebook
    

When you run jupyter notebook, a notebook server starts up and dumps some information to stdout. When you see the line:

当您运行 时jupyter notebook,笔记本服务器启动并将一些信息转储到标准输出。当您看到该行时:

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:

copy the following URL, paste it into the browser on your device, and then hit go. You should end up with something that looks like this:

复制以下 URL,将其粘贴到您设备上的浏览器中,然后点击开始。你应该得到如下所示的结果:

enter image description here

在此处输入图片说明

I tested these instructions out a Nexus 7 2013 (wifi) running stock Android 6.0.1 (Marshmallow).

我在运行库存 Android 6.0.1 (Marshmallow) 的 Nexus 7 2013 (wifi) 上测试了这些说明。

Update: <foo>-devpackages dropped in Termux

更新:<foo>-dev在 Termux 中丢弃的包

As @OmPS pointed out in the comments, Termux dropped all of it's <foo>-devpackages. I've updated step 2. above to match, but I haven't tested it out since I no longer have access to my android device. If someone could please test the current version of the instructions above and then post their experience in the comments, that would be very helpful.

正如@OmPS 在评论中指出的那样,Termux 删除了它的所有<foo>-dev软件包。我已经更新了上面的第 2 步以匹配,但我没有测试它,因为我不再可以访问我的 android 设备。如果有人可以测试上述说明的当前版本,然后在评论中发布他们的经验,那将非常有帮助。

回答by Therii

Download the app pydroid3. Open the app, on the top there is a 3 line button. Click on it there is PIP option click on it. In PIP click on install and type jupyter. Once it gets downloaded, there is terminal option above pip, click on terminal and type jupyter notebook. Your work is done.

下载应用 pydroid3。打开应用程序,顶部有一个 3 行按钮。单击它有 PIP 选项单击它。在 PIP 点击安装并输入jupyter. 下载后,pip 上方有终端选项,单击终端并输入jupyter notebook. 你的工作完成了。

Edit

编辑

I got a video explaining the download of jupyter using pydroid3.

我得到了一个视频,解释了使用 pydroid3 下载 jupyter

回答by Saad Abbasi

I have tried the above instructions and everything works down to the tee except when the following command is run:

我已经尝试了上面的说明,除了运行以下命令时,一切都在发球台上工作:

$ LDFLAGS="-lm -lcompiler_rt" pip install numpy matplotlib

This ends in an error that says that matplotlib could not be installed and the output advises you to install some dependencies.

这以一个错误结束,指出无法安装 matplotlib 并且输出建议您安装一些依赖项。

My own output looks something like this:

我自己的输出看起来像这样:

Screenshot of Error

错误截图

I googled and found that just installing a simple package through following command fixed it:

我用谷歌搜索,发现只需通过以下命令安装一个简单的包即可修复它:

pkg install zlib-dev

after running this command run the following command again and both packages will be installed though it took a lot of time to complete:

运行此命令后,再次运行以下命令,这两个包都将被安装,但需要很长时间才能完成:

$ LDFLAGS="-lm -lcompiler_rt" pip install numpy matplotlib

-cheers

-干杯