15

首先,我是新手……我是 Python、pandas 和 Linux 的新手。

我在尝试填充 DataFrame 时遇到了一些错误(sql.read_frame() 在尝试从我的 MySQL DB 读取时出现异常,但我能够执行并获取查询/存储过程)。我注意到 pandas 的版本是 0.7.0,运行“sudo apt-get install python-pandas”只是说它是最新的(没有错误):“... python-pandas 已经是最新版本。0 升级……”

根据我在网上找到的其他一些帖子,我认为我的 DataFrame 问题可能是由于旧版本的 pandas (涉及元组元组的 pandas 错误?)。为什么 pandas 不会更新到更新的版本?

设置:

Ubuntu: 12.04.2 LTS Desktop (virtual workstation on VMWare)
sudo apt-get update, sudo apt-get upgrade, and sudo apt-get dist-upgrade all current
Python: 2.7.3 (default, April 10 2013, 06:20:15) /n [GCC 4.6.3] on Linux2
$ "which python" only show a single instance: /usr/bin/python
pandas.__version__ = 0.7.0
numpy.__version__ = 1.6.1

我之前尝试安装 Anaconda,但这变成了一场噩梦,Python 版本相互冲突。我终于回滚到之前的 VM 快照并重新开始,在各个包上使用 apt-get 安装所有 MySQL、pandas 和 iPython。

我在这个工作站上没有任何其他问题...... apt-get 似乎总体上工作正常,所有其他应用程序(MySQL Workbench、Kettle / spoon等)都正常工作并且是最新的。

为什么 Python pandas 不会升级到 0.11.0 有什么想法吗?谢谢你。

4

3 回答 3

25

正如 nitin 指出的那样,您可以使用 pip 简单地升级熊猫:

pip install --upgrade pandas

Since this version of pandas will be installed in site-packages you will, in fact, be at the mercy of any automatic updates to packages within that directory. It's wise to install the versions of packages you want into a virtual environment so you have a consistent working environment with the bonus of reproducibility.

To answer your last question, the reason Pandas won't "upgrade" to 0.11.0 using apt-get update is that packages (of Pandas) from your distribution lag behind or haven't been created yet.

于 2013-07-22T02:54:35.480 回答
7

"pip install --upgrade pandas" did not work for me on a fresh Ubuntu: 12.04.2 LTS Desktop instance. Within Python, pandas was still showing version 0.7.0.

Instead, I was able to get the update through by using easy install:

sudo easy_install -U pandas
于 2014-02-28T19:20:58.597 回答
6

尝试用 pip 升级,像这样

pip install --upgrade pandas
于 2013-07-20T06:18:13.913 回答