在Ubuntu 12.04上安装Pandas失败

Der*_*rek 3 python ubuntu install pandas

根据Pandas社区页面(http://pandas.pydata.org/community.html),我首先在这里发帖...

我正在尝试使用pip在运行Ubuntu 12.04.3(64位)的vanilla远程服务器上的虚拟环境中安装Pandas.我已经安装了通常的嫌疑人(python-dev(2.7),numpy,scipy).Pandas没有安装,我不确定要更改或添加什么以确保发生这种情况.

我已经看到其他引用(没有相同的错误)暗示内存可能是一个问题; 远程服务器(Digital Ocean Droplet)只有512MB.

点差错误日志的尾部如下所示:

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
Run Code Online (Sandbox Code Playgroud)

小智 6

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

sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Run Code Online (Sandbox Code Playgroud)

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

创建交换文件后,我重新启动了服务器,键入pip install pandas并最终工作.


小智 5

最安全的方法只是:sudo apt-get install python-pandas