ubuntu 16.04 LTS 上安装 ansible 时的依赖问题

ubuntu 16.04 LTS 上安装 ansible 时的依赖问题

我正在使用Ubuntu 16.04 LTSPython 3.5.2,并尝试在我的计算机上安装 ansible,知道为什么我会收到以下所有错误消息吗?

$ sudo apt-get install ansible
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ansible is already the newest version (2.2.1.0-1ppa~xenial).
0 upgraded, 0 newly installed, 0 to remove and 356 not upgraded.
11 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python-markupsafe (0.23-2build2) ...
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 python-markupsafe (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-jinja2:
 python-jinja2 depends on python-markupsafe; however:
  Package python-markupsafe is not configured yet.

dpkg: error processing package python-jinja2 (--configure):
 dependency problems - leaving unconfigured
Setting up python-yaml (3.11-3build1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          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 python-yaml (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-crypto (2.6.1-6ubuntu0.16.04.2) ...
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 python-crypto (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-ecdsa (0.13-2) ...No apport report written because MaxReports is reached already

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 python-ecdsa (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-paramiko:No apport report written because MaxReports is reached already

 python-paramiko depends on python-crypto (>= 2.1.0-2); however:
  Package python-crypto is not configured yet.
 python-paramiko depends on python-ecdsa; however:
  Package python-ecdsa is not configured yet.

dpkg: error processing package python-paramiko (--configure):
 dependency problems - leaving unconfigured
Setting up python-httplib2 (0.9.1+dfsg-1) ...No apport report written because MaxReports is reached already

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 python-httplib2 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of ansible:No apport report written because MaxReports is reached already

 ansible depends on python-jinja2; however:
  Package python-jinja2 is not configured yet.
 ansible depends on python-yaml; however:
  Package python-yaml is not configured yet.
 ansible depends on python-paramiko; however:
  Package python-paramiko is not configured yet.
 ansible depends on python-httplib2; however:
  Package python-httplib2 is not configured yet.
 ansible depends on python-crypto (>= 2.6); however:
  Package python-crypto is not configured yet.

dpkg: error processing package ansible (--configure):
 dependency problems - leaving unconfigured
Setting up python-apt (1.1.0~beta1build1) ...No apport report written because MaxReports is reached already

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 python-apt (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Setting up python-pycurl (7.43.0-1ubuntu1) ...
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 python-pycurl (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-software-properties:No apport report written because MaxReports is reached already

 python-software-properties depends on python-apt (>= 0.6.20ubuntu16); however:
  Package python-apt is not configured yet.
 python-software-properties depends on python-pycurl; however:
  Package python-pycurl is not configured yet.

dpkg: error processing package python-software-properties (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python-markupsafe
 python-jinja2
 python-yaml
 python-crypto
 python-ecdsa
 python-paramiko
 python-httplib2
 ansible
 python-apt
 python-pycurl
 python-software-properties
E: Sub-process /usr/bin/dpkg returned an error code (1)

我还看到机器上安装了 ansible。

dpkg -l ansible
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                           Version              Architecture         Description
+++-==============================-====================-====================-=================================================================
iU  ansible                        2.2.1.0-1ppa~xenial  all                  A radically simple IT automation platform

谢谢!

答案1

Python 2 和 Python 3 不兼容,Ubuntu 中的很多东西都是基于python运行 Python 2 的假设而设计的。通过改变这一点(甚至是以一种不受支持的方式),你就把所有现有的脚本都搞垮了。

相关内容