【问题标题】:apt-get error: Sub-process /usr/bin/dpkg returned an error code while performing upgradeapt-get 错误:子进程 /usr/bin/dpkg 在执行升级时返回错误代码
【发布时间】:2015-11-26 06:03:20
【问题描述】:

我在 ubuntu 14.04 中执行升级或安装任何软件时出错。

错误:

apt-get error: Sub-process /usr/bin/dpkg returned an error codeReading
 package lists... Done  
Building dependency tree       
Reading state information... Done   
Calculating upgrade... Done
The following packages will be upgraded:
  apport python-libxml2    
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.   
36 not fully installed or removed.   
Need to get 0 B/320 kB of archives.
After this operation, 0 B of additional disk space will be used.    
Do you want to continue? [Y/n] Y

(Reading database ... 242426 files and directories currently installed.)    
Preparing to unpack .../apport_2.14.1-0ubuntu3.19_all.deb ...    
  File "/usr/bin/pyclean", line 63    
    except (IOError, OSError), e:
                             ^    
SyntaxError: invalid syntax    
dpkg: warning: subprocess old pre-removal script returned error exit status 1    
dpkg: trying script from the new package instead ...    
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^   
SyntaxError: invalid syntax   
dpkg: error processing archive /var/cache/apt/archives/apport_2.14.1-
0ubuntu3.19_all.deb (--unpack):    
 subprocess new pre-removal script returned error exit status 1    
Traceback (most recent call last):    
File "/usr/bin/pycompile", line 35, in <module>   
    from debpython.version import SUPPORTED, debsorted, vrepr, \    
  File "/usr/share/python/debpython/version.py", line 24, in <module>   
    from ConfigParser import SafeConfigParser   
ImportError: No module named 'ConfigParser'  
dpkg: error while cleaning up:    
 subprocess installed post-installation script returned error exit status 1   
Preparing to unpack .../python-libxml2_2.9.1+dfsg1-3ubuntu4.5_amd64.deb     
  File "/usr/bin/pyclean", line 63  
    except (IOError, OSError), e: 
SyntaxError: invalid syntax    
dpkg: warning: subprocess old pre-removal script returned error exit status 1   
dpkg: trying script from the new package instead ...    
  File "/usr/bin/pyclean", line 63  
    except (IOError, OSError), e:  
SyntaxError: invalid syntax   
dpkg: error processing archive /var/cache/apt/archives/python-libxml2_2.9.1+dfsg1-3ubuntu4.5_amd64.deb (--unpack):   
 subprocess new pre-removal script returned error exit status 1    
Traceback (most recent call last): 
File "/usr/bin/pycompile", line 35, in <module>  
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser    
ImportError: No module named 'ConfigParser'  
dpkg: error while cleaning up:    
 subprocess installed post-installation script returned error exit status 1 
Errors were encountered while processing:    
 /var/cache/apt/archives/apport_2.14.1-0ubuntu3.19_all.deb  
 /var/cache/apt/archives/python-libxml2_2.9.1+dfsg1-3ubuntu4.5_amd64.deb   
E: Sub-process /usr/bin/dpkg returned an error code (1)

谁能帮我解决这个问题?

提前致谢 ^

【问题讨论】:

  • 错误消息看起来像您的 Python 版本较旧,不支持此 except 语法。如果您的 Ubuntu 确实是最新的 14.04,那根本不可能。但无论如何,这不是一个编程问题,而且您没有提供足够的详细信息来正确诊断问题。

标签: ubuntu dpkg


【解决方案1】:

我已经修复了错误

当我尝试安装仅适用于 python3 的 scikit-learn 时发生此错误。所以,我已经安装了 python3 并将其设置为默认值。

一般来说,ubuntu 与 python2 有一些依赖关系,这个 dpkg 错误是由于将 python3 设置为默认值而发生的。所以,我通过创建链接解决了这个问题。

猜你喜欢
  • 2015-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-19
  • 1970-01-01
  • 2020-01-29
  • 1970-01-01
相关资源
最近更新 更多