无法aptget安装包E:Subprocess/usr/bin/dpkg返回错误代码(1)

2024-10-10 18:22:45 发布

您现在位置:Python中文网/ 问答频道 /正文

每当我尝试使用apt get install安装包时,都会遇到以下错误:

After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python-support (1.0.15) ...
  File "/usr/sbin/update-python-modules", line 52
    print x
          ^
SyntaxError: Missing parentheses in call to 'print'
dpkg: error processing package python-support (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up mercurial-common (3.1.2-2+deb8u1) ...
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 processing package mercurial-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mercurial:
 mercurial depends on mercurial-common (= 3.1.2-2+deb8u1); however:
  Package mercurial-common is not configured yet.

dpkg: error processing package mercurial (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-support
 mercurial-common
 mercurial
E: Sub-process /usr/bin/dpkg returned an error code (1)

我目前正在我的机器上使用python3.4.2。在


Tags: ofinpackagesupportconfigureusrlineerror
1条回答
网友
1楼 · 发布于 2024-10-10 18:22:45

你把默认的Python2改成Python3了吗?目前,Debian附带了一个default Python2 installation。用Python编写的系统脚本,如/usr/sbin/update-python-modules期望python运行Python2的版本。将默认python更改为Python3将导致各种脚本中断。如果您确实将Python3设为默认值,那么解决当前问题的方法是恢复Python2并使其再次成为默认值。在


在Python2中,print是一个语句,因此{}是有效的。在

在Python3中,print是一个函数,因此调用函数需要将参数包装在括号内。因此print x必须改为print(x)print x引起SyntaxError

  File "/usr/sbin/update-python-modules", line 52
    print x
          ^
SyntaxError: Missing parentheses in call to 'print'

使用pyenv or virtualenv来管理/切换python的多个版本,而不是更改系统的默认python。在

相关问题 更多 >