安装包时出现Python pip段错误 [英] Python pip segfault when installing package

查看:125
本文介绍了安装包时出现Python pip段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 2.7.6 (default, Oct 21 2014, 13:39:51) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

在我们运行 Centos 5.4 的旧服务器上一直遇到这个问题.

Been running into this problem forever on our legacy old server running Centos 5.4.

异常信息:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code -11 in /tmp/pip_build_root/macs2

有什么想法吗?一开始我以为是python版本问题,但是我从2.7.1升级到2.7.6还是出现同样的错误.

Any ideas? Initially I thought it was python version problem but I upgraded from 2.7.1 to 2.7.6 and still getting the same error.

点数列表:

numpy (1.9.0)
pip (1.5.6)
setuptools (7.0)
wsgiref (0.1.2)

-编辑当我卸载并使用 numpy ver 1.4.0 时,返回相同的错误,但代码为 1.

-Edit Returns the same error but with code 1 when i uninstall and use numpy ver 1.4.0.

(gdb) 运行 setup.py install --user启动程序:/usr/local/bin/python2.7 setup.py install --user警告:在 0x2aaaaaaab000 处添加的符号文件系统提供的 DSO 中找不到可加载的部分 >>>[启用使用 libthread_db 的线程调试]
程序收到信号 SIGSEGV,分段错误.append_metastr_to_string (meta=0x20, skip_brackets=0, ret=0x2aaaaf29e1e8) at >numpy/core/src/multiarray/datetime.c:1965 1965 if (meta->base == NPY_FR_GENERIC) {

(gdb) run setup.py install --user Starting program: /usr/local/bin/python2.7 setup.py install --user warning: no loadable sections found in added symbol-file system-supplied DSO at 0x2aaaaaaab000 >>>[Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault. append_metastr_to_string (meta=0x20, skip_brackets=0, ret=0x2aaaaf29e1e8) at >numpy/core/src/multiarray/datetime.c:1965 1965 if (meta->base == NPY_FR_GENERIC) {

这是由 wget 完成的,然后解压球

this was done by wget follow by untarring the ball

推荐答案

我在阅读帖子标题后遇到了这个问题,因为我自己遇到了这个问题.在此向未来的读者展示我的案例和解决方案.

I bumped into this after reading title of the post because I myself encountered this issue. Presenting my case and solution here for any future reader.

我的工作流程如下所示:

My workflow looked like this:

$ pip install simplejson
Collecting simplejson
Installing collected packages: simplejson
Successfully installed simplejson
Segmentation fault (core dumped)

解决方案

因为我在这个系统上有 root 权限,所以我尝试做一个类似的流程,但作为另一个用户,它成功通过,没有任何问题.我认为这与我的用户主管有关,因此我擦除了我的 .local 文件夹

$ rm -rf ~/.local/lib/python*

上面相同的工作流程现在成功通过,尽管有一个 pip 警告,大多数人都知道这无关紧要.

The same workflow above now passed successfully albeit with a pip warning, which as most know wouldn't matter much.

$ pip install simplejson
Collecting simplejson
Installing collected packages: simplejson
Successfully installed simplejson
You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

可能的原因

当我尝试使用简单的用户权限回滚我的用户帐户时,我强制安装了 pip,这将覆盖 /usr/bin/pip 处的系统 pip与 .local 文件夹中的那个.然后我从我的 .local 文件夹中手动删除了 pip 的二进制文件,这个问题开始出现.在我看来,我的用户帐户中仍然有一些对 pip 包的引用.当您处理多个 Python 版本并像我一样手动删除任何二进制文件时,也可能发生这种情况.

Possible Cause

As I try to rewind what I did my user account, with simple user privileges, I force installed pip which would override system's pip at /usr/bin/pip with the one in .local folder. And then I manually removed pip's binaries from my .local folder and this issue started popping up. Seems to me that there were some references still being made to the pip package inside my user account. Might also happen when you are juggling with multiple python versions and manually remove any binaries like I did.

这篇关于安装包时出现Python pip段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆