如何安装 Python Pandas?

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

How to install Python Pandas?

pythonmacosnumpypandaspackages

提问by 30114

I have a huge problem with Python packages. I'm completely newbie when it comes to Python and I'm having trouble for a long time. Anyway, I succeed in installing NumPy package and after that I can't install anything by simply using python setup.py installin the terminal.

我有一个 Python 包的大问题。说到 Python,我完全是新手,而且我遇到了很长时间的麻烦。无论如何,我成功安装了 NumPy 包,之后我无法通过python setup.py install在终端中简单地使用来安装任何东西。

I'd like to install pandas package, but I'm getting the same error every time:

我想安装 pandas 包,但每次都遇到相同的错误:

[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-539.pth'.

I went one step backward and tried to install "pip" and/or "setuptools", but I'm getting the same error [Errno 13]every time.

我倒退了一步,尝试安装“pip”和/或“setuptools”,但[Errno 13]每次都遇到相同的错误。

Is there a way to "easily" or even "understandably" install Python packages.

有没有办法“轻松”甚至“可理解地”安装 Python 包。

回答by andrewdleach

Permission denied error stems from not having write access when installing a package. On unix like systems the command is "sudo".

权限被拒绝错误源于安装包时没有写访问权限。在类 Unix 系统上,命令是“sudo”。

So, whatever package manager you use to download pandas, whichever package, start the command with "sudo" to ensure that you grant yourself write access for a download.

因此,无论您使用什么包管理器来下载 Pandas,无论哪个包,请以“sudo”启动命令,以确保您授予自己下载的写访问权限。

Example: (This is for a Linux box)

示例:(这是针对 Linux 机器的)

sudo apt-get install pip 

And then with pip (the python package manager)

然后使用 pip(python 包管理器)

pip install <package-name>

With a Mac, you would either have to use homebrew or macports as your package manager.

对于 Mac,您必须使用 homebrew 或 macports 作为您的包管理器。

Install homebrew like this:

像这样安装自制软件:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

And then use brew to install pip

然后使用 brew 安装 pip

brew install pip

And just as before pip to install python packages

和之前一样 pip 安装 python 包

pip install <package-name>

回答by andrewdleach

Ok, this is not the answer to your question, but Anaconda works flawless for Linux. But I guess it is the same for Apple: http://continuum.io/downloads#py34

好的,这不是您问题的答案,但 Anaconda 在 Linux 上运行完美。但我想苹果也是一样的:http: //continuum.io/downloads#py34

回答by Rohit K.R.

While installing pandas, I had the error of

安装时pandas,我有错误

'Could not install packages due to environmental errors: ...'

'由于环境错误而无法安装软件包:...'

while uninstalling python-dateutil 1.5.

在卸载python-dateutil 1.5.

It was solved using this command.

用这个命令解决了。

sudo pip install --ignore-installed python-dateutil pandas

回答by Omid Goudazi

you can use easy_install too:

你也可以使用easy_install:

first install easy_install tool and then use it like:

首先安装easy_install工具,然后像这样使用它:

easy_install pandas

回答by 30114

Thank you all for your help!!!

谢谢大家的帮助!!!

I'll suggest everyone facing the same problem to install brew and then follow the steps posted above.

我会建议每个面临同样问题的人安装 brew,然后按照上面发布的步骤操作。

If you still have problem ([Errno 13]), try with "sudo su" first, then follow the installation steps you need.

如果您仍然有问题([Errno 13]),请先尝试“sudo su”,然后按照您需要的安装步骤进行操作。

Best, Zona

最好的,佐纳

回答by prasanth yadla

you can try the following. sudo easy_install pandas

您可以尝试以下操作。须藤easy_installPandas