如何为 Python 3 安装 Pandas?

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

How to install pandas for Python 3?

pythonpandasinstallpippython-3.4

提问by Roman

I try to install pandas for Python 3 by executing the following command:

我尝试通过执行以下命令为 Python 3 安装 pandas:

sudo pip3 install pandas

As a result I get this:

结果我得到了这个:

Downloading/unpacking pandas
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement pandas
Cleaning up...
No distributions at all found for pandas

Maybe it is interesting to note that installation for Python 2 works fine.

也许有趣的是,Python 2 的安装工作正常。

sudo pip install pandas

Returns the following:

返回以下内容:

Requirement already satisfied (use --upgrade to upgrade): pandas in /usr/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in /usr/lib/python2.7/dist-packages (from pandas)
Cleaning up...

ADDED

添加

I have just installed pandas in the following way:

我刚刚通过以下方式安装了熊猫:

sudo apt-get install python3-pandas

回答by Ananda

Try this:

尝试这个:

sudo apt-get install python3-pip
sudo -H pip3 install pandas

回答by CubeBot88

I believe for Python 3.4 you should use: pip3 install 'pandas<0.21'. Don't forget, if your machine requires a proxy, add this bit after install: --proxy=http://sub_domain_proxy.sub_domain.domain:port

我相信对于 Python 3.4,您应该使用:pip3 install 'pandas<0.21'. 不要忘记,如果您的机器需要代理,请在安装后添加这一点:--proxy=http://sub_domain_proxy.sub_domain.domain:port

回答by mamadh1378

Most of the time, pip gives me errors (I really don't know why), so I use apt-get instead.

大多数时候,pip 给我错误(我真的不知道为什么),所以我使用 apt-get 代替。

For python3 use:

对于python3使用:

sudo apt-get install python3-pandas

For python2 use:

对于python2使用:

sudo apt-get install python-pandas

回答by Shinto Joseph

This worked for me, finally:

这对我有用,最后:

pip3 install pandas --no-build-isolation