Raspberry Pi-Python:在 Python 3.5.2 上安装 Pandas

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42682928/
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-09-14 03:08:23  来源:igfitidea点击:

Raspberry Pi-Python: Install Pandas on Python 3.5.2

pythonpython-3.xpandaspipraspberry-pi3

提问by Victor Sg

  1. I have a Raspberry 3 Model B with the latest version of Raspbian (installed with Noobs 2.3.0).
  2. I have successfully installed Python 3.5.2 using the instructions found in this post: http://bohdan-danishevsky.blogspot.com.es/2015/10/building-python-35-on-raspberry-pi-2.html
  3. I am trying to install Pandas (particularly, version 0.18 or higher), on that version of Python (not 3.4).
  4. I have tried pip install, but can't make it point to python 3.5.2 even uninstalling version 3.4. I have also tried

    sudo apt-get install python3-pandas
    

    with no luck...

  1. 我有一个 Raspberry 3 Model B 和最新版本的 Raspbian(安装了 Noobs 2.3.0)。
  2. 我已经使用这篇文章中的说明成功安装了 Python 3.5.2:http: //bohdan-danishevsky.blogspot.com.es/2015/10/building-python-35-on-raspberry-pi-2.html
  3. 我正在尝试在该版本的 Python(不是 3.4)上安装 Pandas(特别是 0.18 或更高版本)。
  4. 我已经尝试过 pip install,但即使卸载了 3.4 版,也无法让它指向 python 3.5.2。我也试过

    sudo apt-get install python3-pandas
    

    没有运气...

I am quite desperate. Is there no way to do this? I have searched for multiple solutions in this site and still nothing.

我很绝望。没有办法做到这一点吗?我在这个网站上搜索了多种解决方案,但仍然没有。

Does anyone know how to do it?
Thanks

有谁知道怎么做?
谢谢

回答by s-huffman

I'd been searching for the same thing: a way to "install" the current version of pandas on a Raspberry Pi 3. Using apt-get to install it on the RPi pulls an outdated version of pandas from the Raspbian repository.

我一直在寻找同样的东西:一种在 Raspberry Pi 3 上“安装”当前版本的 Pandas 的方法。使用 apt-get 将其安装在 RPi 上会从 Raspbian 存储库中提取过时版本的 Pandas。

On GitHub. I found two solutions for installing the current version of pandas (and Python/packages in general) on the RPi 3: one solution involves building and installing pandas directly on the Raspberry Pi, and the other solution involves installing a current Raspberry Pi version of conda (called BerryConda) on the Raspberry Pi and then downloading the current version of pandas as an RPi package from the Anaconda Cloud.

在 GitHub 上。我找到了两种在 RPi 3 上安装当前版本的 pandas(以及一般的 Python/包)的解决方案:一种解决方案涉及直接在 Raspberry Pi 上构建和安装 pandas,另一种解决方案涉及安装当前 Raspberry Pi 版本的 conda (称为 BerryConda),然后从 Anaconda Cloud 下载当前版本的 Pandas 作为 RPi 包。

Solution 1:

解决方案1:

User kleineeon GitHub has created a script that will create a Jupyter notebook server on Raspberry Pi 2 and/or 3. Although, the intent of the script is to create a Jupyter notebook server, it can be modified easily to install only the current version of pandas on the RPi.

GitHub 上的用户kleinee创建了一个脚本,该脚本将在 Raspberry Pi 2 和/或 3 上创建 Jupyter Notebook 服务器。尽管该脚本的目的是创建 Jupyter Notebook 服务器,但可以轻松修改它以仅安装当前版本RPi 上的Pandas。

The script starts by downloading the most recent version of Python 3 (currently, 3.6.1), setting it up and installing it on the RPi. The script then goes on to download other parts of what he calls a "scientific stack," which includes the current version of pandas. He also provides another script that will check for updates to installed Python packages and automatically update them, as necessary.

该脚本首先下载最新版本的 Python 3(当前为 3.6.1),进行设置并将其安装在 RPi 上。然后脚本继续下载他所谓的“科学堆栈”的其他部分,其中包括当前版本的Pandas。他还提供了另一个脚本,用于检查已安装 Python 包的更新并在必要时自动更新它们。

You can run the entire script as is (to install current versions of Python, jupyter, pandas, numpy, scipy, matplotlib, etc.) or you can edit the script to install only the current version of pandas. I ran the script "as is" yesterday and it took about 4 hours to install Python and the included "stack" (to include pandas) on my RPi 3.

您可以按原样运行整个脚本(安装当前版本的 Python、jupyter、pandas、numpy、scipy、matplotlib 等),也可以编辑脚本以仅安装当前版本的 pandas。我昨天“按原样”运行了脚本,在我的 RPi 3 上安装 Python 和包含的“堆栈”(包括Pandas)花了大约 4 个小时。

The advantage to this solution is that you are downloading the current version of Python and packages directly from the source, so you will always get the most recent version. The disadvantage is that you have to "build" them locally on the RPi, which will take time (4 hours, in my case, for about a dozen packages, including Python itself).

此解决方案的优点是您可以直接从源代码下载当前版本的 Python 和软件包,因此您将始终获得最新版本。缺点是您必须在 RPi 本地“构建”它们,这需要时间(在我的情况下,大约需要 4 小时,包括 Python 本身)。

Solution 2:

解决方案2:

User jjhelmushas created "BerryConda," a current RPi version of conda. He has also created Python packages (including the current version of pandas) that he makes available on the RPi channel at Anaconda Cloud. Using this solution, you can install the current version of pandas using BerryConda without having to compile it, like you do in solution 1.

用户jjhelmus创建了“BerryConda”,这是 conda 的当前 RPi 版本。他还创建了 Python 包(包括当前版本的 pandas),并在 Anaconda Cloud 的 RPi 频道上提供这些包。使用此解决方案,您可以使用 BerryConda 安装当前版本的 Pandas,而无需编译它,就像在解决方案 1 中所做的那样。

The advantage to this solution is that you do not have to compile anything locally, so setup is much faster. A possible disadvantage is that BerryConda and the associated packages are built and maintained by someone not associated with Anaconda or Continuum Analytics who may or may not continue to do so in the future. Although, the BerryConda packages are currently up-to-date, there's no guarantee that will be the case going forward.

此解决方案的优点是您无需在本地编译任何内容,因此安装速度要快得多。一个可能的缺点是 BerryConda 和相关的包是由与 Anaconda 或 Continuum Analytics 无关的人构建和维护的,他们将来可能会也可能不会继续这样做。尽管 BerryConda 软件包目前是最新的,但不能保证未来会如此。