配置 gconf 时出现“TypeError:类型 str 不支持缓冲区 API”

配置 gconf 时出现“TypeError:类型 str 不支持缓冲区 API”

“检查更新时出现问题”我注意到带有白线的红圈至少有一个星期了。不确定是不是因为我改了 Python 版本,或者更新被从中间切断了。最重要的是我无法进入我的存储库等。右键单击带灯的红圈会显示一些选项,例如安装所有更新,但没有任何响应。

我确实研究过有关此问题的先前评论,但似乎没有人解决这个问题。

以下是执行后的输出

sudo apt-get -f install 

E: Sub-process /usr/bin/dpkg returned an error code (1)
eyal@eyal:~$ sudo apt-get -f install
Reading package lists...Done
eyal@eyal:~$ sudo apt-get -f install
Reading package lists...Done
Building dependency tree

Reading state information...Done
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up ipython (0.10.2-1) ...

Traceback (most recent call last):

File "/usr/bin/pycompile", line 36, 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 ipython (--configure):

subprocess installed post-installation script returned error exit status 1
No apport writen becaouse MaxReports is reached already

Errors were encountered while processing:
ipython

我进行了更新并尝试安装软件包:

Reading package lists...
  Building dependency tree...
  Reading state information...
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  3 not fully installed or removed.
  After this operation, 0 B of additional disk space will be used.
  Setting up gconf2 (3.2.3-0ubuntu0.1) ...
  Traceback (most recent call last):
  File "/usr/sbin/gconf-schemas", line 120, in <module>
    trim(os.path.join(defaults_dest,"%gconf-tree.xml"), get_valid_languages())
  File "/usr/sbin/gconf-schemas", line 18, in get_valid_languages
    langs.add(l.split('_')[0])
 TypeError: Type str doesn't support the buffer API
 dpkg: error processing gconf2 (--configure):
 subprocess installed post-installation script returned error exit status 1
 Setting up ipython (0.10.2-1) ...
 Traceback (most recent call last):
  File "/usr/bin/pycompile", line 36, 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 ipython (--configure):
 subprocess installed post-installation script returned error exit status 1
 dpkg: dependency problems prevent configuration of compiz-plugins-main-default:
 compiz-plugins-main-default depends on gconf2 (>= 2.28.1-2); however:
  Package gconf2 is not configured yet.
 dpkg: error processing compiz-plugins-main-default (--configure):
 dependency problems - leaving unconfigured
 Errors were encountered while processing:
 gconf2
 ipython
 compiz-plugins-main-default
 E: sub-process /usr/bin/dpkg returned an error code(1)

    E: Sub-process /usr/bin/dpkg returned an error code (1)

似乎主要问题来自于:处理时遇到错误: gconf2 伊帕特里克

sudo dpkg --configure gconf2
[sudoo] password for eyal:
setting up conf2 (3.2.3-0ubuntu0.1) ...
Trackback (most recent call last):
 File '/usr/sbin/gconf-schemas", line 120, in <module>
   trim (os.path.join(defaults_dest, "%gconf-tree.xml")
 File '/usr/sbin/gconf-schemas", line 18, in get_valid_languages
 langs.add(l.split('_')[0])
TypeError: type str dosen't support the buffer API
dpkg error: error processing gconf2(--configure):
 subprocess installed post-instalation script returned error exit satus 1
Erros were encountered while processing:
gconf2

答案1

我遇到了完全相同的问题,你应该检查系统指向的默认 Python 版本。一些软件力量我使用 python 3.2,所以我手动切换 python 版本。

sudo ln -s /usr/bin/python3.2 /usr/bin/python

然后我遇到了您在此处描述的问题,我将其切换回 2.7,然后重新运行配置步骤。

sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
sudo dpkg --configure gconf2

而且一切进行得很顺利...我希望它会有所帮助。

答案2

有时损坏的安装包会损坏您的包管理系统,导致您的 Linux 无法安装或删除任何包(软件)。这是我尝试为 Ubuntu 安装 ndas-admin 后从 apt-get 收到的消息错误消息。

$sudo apt-get install mplayer(或任何软件包) 正在读取软件包列表…完成 正在构建依赖关系树
正在读取状态信息…完成 E:需要重新安装软件包 ndas-admin,但我找不到它的存档。(这是错误)

我尝试:$ sudo apt-get install -f ,尝试修复该问题,但出现相同的错误。我唯一的选择是手动编辑 dpkg 状态文件。

$ sudo gedit /var/lib/dpkg/status    (if you prefer you can use vi instead of gedit)
Locate the corrupt package, and remove the whole block of information about it and save the file. Mine looked like this:

Package: ndas-admin
Status: deinstall reinstreq half-configured
Priority: extra
Section: alien
Installed-Size: 100
Maintainer: root <root@ubuntu510>
Architecture: i386
Version: 1.0.2-24
Depends: libc6 (>= 2.3.4-1)
Description: Administration toosl for XIMETA,Inc NDAS device driver for Linux operating system
 ndas-admin – This program allows the user to register/enable/disable/unregister the XIMETA NDAS hard disk.
 .
 (Converted from a rpm package by alien version 8.53.)

已修复。希望这对其他人有帮助。

答案3

不知道为什么,我在常规系统更新(Ubuntu 13.10,amd64)后遇到了类似的问题。我花了很多时间在谷歌上搜索,但没有任何帮助。系统中默认的python是2.7版本。我发现问题是因为更新后/usr/share/python/debpython目录不存在。

我按照以下方式解决了该问题:

apt-get download python-minimal
sudo dpkg -i python-minimal_2.7.5-5ubuntu1_amd64.deb
sudo apt-get -f install

最后检查一切是否正常

sudo dpkg --audit

答案4

我的薄荷有问题:

    Errors were encountered while processing:
       python-m2crypto
       python-sqlite
       python-urlgrabber
       python-yaml
       python-rpm
       osc
       python-iniparse
    E: Sub-process /usr/bin/dpkg returned an error code (1)

因此我检查一下:

$ sudo dpkg --audit
The following packages are only half configured, probably due to problems
configuring them the first time. The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
 python-yaml          YAML parser and emitter for Python
 python-m2crypto      a crypto and SSL toolkit for Python
 python-sqlite        Python interface to SQLite 2
 osc                  OpenSUSE (buildsystem) commander
 python-rpm           Python bindings for RPM
 python-iniparse      Module to access and modify configuration data in INI fil
 python-urlgrabber    A high-level cross-protocol url-grabber

我按照以下方式解决了该问题:

$ sudo apt-get download python-minimal
$ sudo dpkg -i python-minimal_2.7.5-5ubuntu1_amd64.deb
$ sudo apt-get -f install
Setting up python-m2crypto (0.20.1+dfsg1-1.1ubuntu1) ...
Setting up python-sqlite (1.0.1-8) ...
Setting up python-urlgrabber (3.9.1-4ubuntu1) ...
Setting up python-yaml (3.10-1) ...
Setting up python-rpm (4.9.0-7ubuntu0.1) ...
Setting up osc (0.132.4-1) ...
Setting up python-iniparse (0.4-2.1) ...
$ sudo dpkg --audit output blank

解决了!

相关内容