如何通过 SSH 在 EC2 实例上安装 Pandas
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19580038/
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
How to install pandas through SSH on EC2 instance
提问by Geoffrey Dobson
I am attempting to run some Python code on the default Amazon EC2 instance. I ran the following command to get the version:
我正在尝试在默认的 Amazon EC2 实例上运行一些 Python 代码。我运行以下命令来获取版本:
[ec2-user@ip-172-31-0-107 ~]$ cat /proc/version
Linux version 3.4.62-53.42.amzn1.x86_64 (mockbuild@gobi-build-31004) (gcc versio n 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #1 SMP Fri Sep 20 07:23:24 UTC 2013
Now I want to install pandas. So I did:
现在我想安装Pandas。所以我做了:
[ec2-user@ip-172-31-0-107 ~]$ sudo yum install pandas
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
No package pandas available.
没有可用的包Pandas。
How do I install pandas on Amazon EC2?
如何在 Amazon EC2 上安装 Pandas?
回答by foobarbecue
I think pandas is in the Redhat packages as python-pandas, in which case:
sudo yum install python-pandasUnfortunately, Redhat does not publicly publish a list of their packages so I'm not sure.
我认为 Pandas 在 Redhat 软件包中是 python-pandas,在这种情况下:
sudo yum install python-pandas不幸的是,Redhat 没有公开发布他们的软件包列表,所以我不确定。
Alternatively you can use the python packaging system, pip. To install pip:
或者,您可以使用 python 打包系统 pip。要安装 pip:
sudo easy_install pip
sudo easy_install pip
and then
进而
sudo pip install pandas
sudo pip install pandas
回答by Shoresh
The solution suggested by foobarbecue did not work for me. Instead, follow the commands below, ENTIRELY copied from this post, and it should solve your problem. Also, make sure you read the comments as well.
foobarbecue 建议的解决方案对我不起作用。相反,请按照以下命令完全从这篇文章中复制,它应该可以解决您的问题。另外,请确保您也阅读评论。
#!/bin/bash
sudo yum install update
sudo yum groupinstall "Development Tools"
sudo yum install python-devel libpng-devel freetype-devel
#the last two are necessary for pip to run without failing with
#error 'Command "python setup.py egg_info" failed with error code 1'
sudo pip install pandas #Finally it works!
回答by user11968704
I'm just recently setup EC2 RHCL and also look for PIP installation, so I would like to share my latest update
我最近刚刚安装了 EC2 RHCL 并且也在寻找 PIP 安装,所以我想分享我的最新更新
sudo pip3 install pandas
Installating collected packages: numpy, pandas
安装收集到的包:numpy、pandas
Now we have both NumPy and pandas installed
现在我们已经安装了 NumPy 和 Pandas

