在 python 2.7、ubuntu 12.04 中安装 Pandas
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17194981/
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
installing pandas in python 2.7, ubuntu 12.04
提问by Poruri Sai Rahul
when i initially ran
当我最初跑
$ pip install pandas
it gave me an error that i don't have permissions. then when i tried
它给了我一个错误,我没有权限。然后当我尝试
$ sudo pip install pandas
it gave me this -
它给了我这个——
fatal error: Python.h: No such file or directory
After some search, i came across this command
经过一番搜索,我遇到了这个命令
$ sudo pip install -U pandas
after a very, very verbose output, it gave the same error but this time it prompted me that i might need/want to install python-dev & python-setuptools after installing python-dev, pip install pandas worked fine and without a hitch!
在一个非常非常详细的输出之后,它给出了同样的错误,但这次它提示我在安装 python-dev 后我可能需要/想要安装 python-dev 和 python-setuptools,pip install pandas 工作正常,没有任何问题!
So, my question is, does anyone know why this problem occurred?! Has this occurred before?! and what does the -U in $ pip install -U ... stand for?! it isn't mentioned in the help page for pip, i checked!
所以,我的问题是,有谁知道为什么会出现这个问题?!以前有过这种情况吗?!$ pip install -U ... 中的 -U 代表什么?!pip 的帮助页面中没有提到它,我检查了!
Also, i know that there's a log file for at /home/user/.pip/pip.log but instead of appending error messages to the log file, it gets rewritten each time there's pip runs into a problem.
另外,我知道 /home/user/.pip/pip.log 有一个日志文件,但不是将错误消息附加到日志文件,而是在每次 pip 遇到问题时重写。
Is there anyway to fix this?! Also, can i make pip log every install as well and not just the ones that went wrong! instead of having to do
有没有什么办法解决这一问题?!另外,我可以让 pip 记录每次安装吗,而不仅仅是那些出错的!而不是必须做
$ pip install ... >> LOG_FILE
everytime!
每次!
EDIT 1 : turns out i didn't do enough research, i found that Python.h isn't necessarily installed by default though i have them installed.
编辑 1:结果我没有做足够的研究,我发现 Python.h 不一定默认安装,尽管我已经安装了它们。
But i'd still like to know what the -U stands for and how to keep a log file in pip.
但我仍然想知道 -U 代表什么以及如何在 pip 中保存日志文件。
回答by Fred Foo
You always need the python-devpackage to compile Python C extensions such as the ones in Pandas. When you install Python from source, they're installed along, but not with the Ubuntu package.
你总是需要这个python-dev包来编译 Python C 扩展,比如 Pandas 中的扩展。从源代码安装 Python 时,它们会一起安装,但不会随 Ubuntu 软件包一起安装。
From pip install --help:
来自pip install --help:
-U, --upgrade Upgrade all packages to the newest available version

