在Ubuntu 12.04上安装Pandas失败

3
根据Pandas社区页面(http://pandas.pydata.org/community.html),我首先在这里发布...... 我正在尝试在虚拟环境中使用pip安装Pandas,该环境位于运行Ubuntu 12.04.3(64位)的普通远程服务器上。我已经安装了通常的软件包(python-dev(2.7),numpy,scipy)。Pandas没有被安装,我不确定需要更改或添加什么才能确保成功。我看到其他参考资料(没有相同的错误)暗示内存可能是一个问题;远程服务器(Digital Ocean droplet)只有512MB。pip错误日志的末尾如下所示:
gcc: internal compiler error: Killed (program cc1)

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

error: command 'gcc' failed with exit status 4

----------------------------------------

Command /srv/tp/venv/bin/python -c "import setuptools;__file__='/srv/tp/venv/build/pandas/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0bOHrG-record/install-record.txt --install-headers /srv/tp/venv/include/site/python2.7 failed with error code 1 in /srv/tp/venv/build/pandas

Exception information:
Traceback (most recent call last):
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
    requirement_set.install(install_options, global_options)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
    requirement.install(install_options, global_options)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 577, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/srv/tp/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 256, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /srv/tp/venv/bin/python -c "import setuptools;__file__='/srv/tp/venv/build/pandas/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0bOHrG-record/install-record.txt --install-headers /srv/tp/venv/include/site/python2.7 failed with error code 1 in /srv/tp/venv/build/pandas
3个回答

6

我曾在Ubuntu上遇到相同的问题和错误,后来创建了一个交换文件,问题就解决了!可以在下面的链接中找到教程,简而言之:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04

在创建交换文件后,我重新启动了服务器,输入了pip install pandas,最终成功了。


5
最安全的方式是使用以下命令:sudo apt-get install python-pandas

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接