E: 安装google or-tools时子进程/usr/bin/dpkg返回错误码(1)

Posted

技术标签:

【中文标题】E: 安装google or-tools时子进程/usr/bin/dpkg返回错误码(1)【英文标题】:E: Sub-process /usr/bin/dpkg returned an error code (1) while installing google or-tools 【发布时间】:2018-12-28 08:25:59 【问题描述】:

尝试安装 or-tools 但收到下面提到的错误。以下是运行 or-tools 安装命令时的完整错误代码。

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up python-colorama (0.3.2-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 processing package python-colorama (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-distlib (0.1.9-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 processing package python-distlib (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-html5lib (0.999-3) ...
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-html5lib (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-setuptools (5.5.1-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 processing package python-setuptools (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-pip:
 python-pip depends on python-colorama; however:
  Package python-colorama is not configured yet.
 python-pip depends on python-distlib; however:
  Package python-distlib is not configured yet.
 python-pip depends on python-html5lib; however:
  Package python-html5lib is not configured yet.
 python-pip depends on python-setuptools (>= 0.6c1); however:
  Package python-setuptools is not configured yet.

dpkg: error processing package python-pip (--configure):
 dependency problems - leaving unconfigured
Setting up python-wheel (0.24.0-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 processing package python-wheel (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python-colorama
 python-distlib
 python-html5lib
 python-setuptools
 python-pip
 python-wheel
E: Sub-process /usr/bin/dpkg returned an error code (1)

用于安装 or-tools 的命令。

    sudo apt-get -y install python3-dev python3-wheel python3-setuptools python3-six

我需要做什么来解决这个问题并安装 or-tools? 我是否需要删除导致问题的软件包。已经有一个项目正在运行,但不确定删除这些项目是否会产生影响。

【问题讨论】:

这不是编程问题。请检查 stackexchange 网络以寻找更适合的网站。 请提供详细的错误信息。 @GenoChen,已更新代码 【参考方案1】:

日志已经显示,

ImportError: 没有名为“ConfigParser”的模块

然后你只需要安装那个模块,可能使用pipeasy_install

$ pip install configparser

【讨论】:

尝试安装 ConfigParser。使用 pip 它说 Traceback(最近一次调用最后):文件“/usr/local/bin/pip”,第 7 行,在 from pip._internal import main ImportError: No module named 'pip._internal ' and with easy_install 搜索configparser 最佳匹配:configparser 3.5.0 处理configparser-3.5.0-py3.4.egg configparser 3.5.0 已经是easy-install.pth 中的活动版本 使用/ usr/local/lib/python3.4/dist-packages/configparser-3.5.0-py3.4.egg configparser的依赖处理完成 configparser的依赖处理完成 @python_user 哦,您的pip 似乎已损坏,并且已按照easy_install 的说明安装了configparser。你发了virtualenv吗?

以上是关于E: 安装google or-tools时子进程/usr/bin/dpkg返回错误码(1)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 AWS Lambda 上安装 Google or-tools?

如何在 macOS 上为 IntelliJ 项目安装 Google OR-Tools

在 Windows 10 (Intellij IDEA) 上使用 gradle 项目安装 Google or-tools

Google Or-Tools:UnsatisfiedLinkError

在 Eclipse 中使用 google or-tools

如何获取 Google OR-Tools 的进度日志?