错误处理python2.7-minimal

时间:2013-11-02 02:07:05

标签: python-2.7 ubuntu-12.04

最新的apt-get升级失败了:

Setting up python2.7-minimal (2.7.3-0ubuntu3.4) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site.py", line 563, in <module>
    main()
  File "/usr/local/lib/python2.7/site.py", line 545, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/lib/python2.7/site.py", line 278, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/lib/python2.7/site.py", line 253, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/lib/python2.7/site.py", line 243, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/lib/python2.7/sysconfig.py", line 520, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/lib/python2.7/sysconfig.py", line 419, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/local/lib/python2.7/sysconfig.py", line 298, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/include/python2.7       /pyconfig.h (No such file or directory)
dpkg: error processing python2.7-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 python2.7-minimal

重新安装python2.7-minimal失败,因为找不到/usr/local/include/python2.7/pyconfig.h。我有替代安装:

root@ely:~# sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python2.7   60        auto mode*
  1            /usr/bin/python2.7   60        manual mode
  2            /usr/bin/python3     40        manual mode

root@ely:~# whereis python
python: /usr/bin/python3.2mu /usr/bin/python2.7 /usr/bin/python2.7-config /usr/bin      
/python /usr/bin/python3.2 /usr/bin/python2.7-dbg-config /usr/bin/python2.7-dbg     
/etc/python2.7 /etc/python /etc/python3.2 /usr/lib/python2.7 /usr/lib/python3.2 /usr/bin
/X11/python3.2mu /usr/bin/X11/python2.7 /usr/bin/X11/python2.7-config /usr/bi/X11/python 
/usr/bin/X11/python3.2 /usr/bin/X11/python2.7-dbg-config /usr/bin/X11/python2.7-dbg 
/usr/local/bin/python3.2m /usr/local/bin/python2.7 /usr/local/bin/python3.2m-config 
/usr/local/bin/python2.7-config /usr/local/bin/python3.2 /usr/local/bin/python3.2-config 
/usr/local/lib/python2.7 /usr/local/lib/python3.2 /usr/include/python3.2mu /usr/include
/python2.7 /usr/include/python2.7_d /usr/include/python3.2 /usr/include/python3.2_d 
/usr/share/python /usr/share/man/man1/python.1.gz

但pyconfig.h只能在/usr/include/python*.*/中找到(因为它应该是?)

发生了什么事?如何修复(其他软件包的安装受到影响)?感谢。

1 个答案:

答案 0 :(得分:0)

在ubuntu上重新安装python IOError:无效的Python安装:无法打开/usr/local/include/python2.7,然后查找找不到/pyconfig.h,您需要安装此文件并在请求时添加它添加它