Python3.2 错误;无法安装或删除任何内容

Python3.2 错误;无法安装或删除任何内容

我尽可能地搜索,但似乎找不到解决我的问题的方法。

无论我安装什么、删除什么、运行sudo apt-get update什么sudo apt-get upgrade,我似乎仍然收到以下消息:

Setting up python3.2 (3.2.3-0ubuntu3.2) ...
Traceback (most recent call last):
  File "/usr/lib/python3.2/py_compile.py", line 187, in <module>
    sys.exit(main())
  File "/usr/lib/python3.2/py_compile.py", line 179, in main
    compile(filename, doraise=True)
  File "/usr/lib/python3.2/py_compile.py", line 111, in compile
    with tokenize.open(file) as f:
  File "/usr/lib/python3.2/tokenize.py", line 344, in open
    encoding, lines = detect_encoding(buffer.readline)
  File "/usr/lib/python3.2/tokenize.py", line 332, in detect_encoding
    encoding = find_cookie(second)
  File "/usr/lib/python3.2/tokenize.py", line 304, in find_cookie
    codec = lookup(encoding)
  File "/usr/lib/python3.2/encodings/__init__.py", line 98, in search_function
    level=0)
EOFError: EOF read where not expected
dpkg: error processing python3.2 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libopenimageio1.0 (1.0.9+git20120918-0irie3~precise1) ...
dpkg: dependency problems prevent configuration of libpython3.2:
 libpython3.2 depends on python3.2 (= 3.2.3-0ubuntu3.2); however:
  Package python3.2 is not configured yet.
dpkg: error processing libpython3.2 (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 python3.2
 libpython3.2

值得一提的是,这个问题发生在我更新电脑后,当时城市停电了。当我在恢复供电后重新启动电脑时,系统变得非常慢,更新似乎显示“部分升级”。我取消了它,运行了sudo apt-get install -f所有必要的命令让它运行,但之后它似乎不起作用了。

进一步说明:尝试安装 Synaptic 时,出现此错误:

Setting up python3.2 (3.2.3-0ubuntu3.2) ...
Traceback (most recent call last):
  File "/usr/lib/python3.2/py_compile.py", line 187, in <module>
    sys.exit(main())
  File "/usr/lib/python3.2/py_compile.py", line 179, in main
    compile(filename, doraise=True)
  File "/usr/lib/python3.2/py_compile.py", line 111, in compile
    with tokenize.open(file) as f:
  File "/usr/lib/python3.2/tokenize.py", line 344, in open
    encoding, lines = detect_encoding(buffer.readline)
  File "/usr/lib/python3.2/tokenize.py", line 332, in detect_encoding
    encoding = find_cookie(second)
  File "/usr/lib/python3.2/tokenize.py", line 304, in find_cookie
    codec = lookup(encoding)
  File "/usr/lib/python3.2/encodings/__init__.py", line 98, in search_function
    level=0)
EOFError: EOF read where not expected
dpkg: error processing python3.2 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of libpython3.2:
 libpython3.2 depends on python3.2 (= 3.2.3-0ubuntu3.2); however:
  Package python3.2 is not configured yet.
dpkg: error processing libpython3.2 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                            Errors were encountered while processing:
 python3.2
 libpython3.2
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

尝试运行

sudo dpkg --configure -a

重新配置您的依赖项。

您也可以尝试手动编辑包状态文件


来源:http://www.iasptk.com/ubuntu-fix-broken-package-best-solution

答案2

我“认为”我设法解决了自己的问题(尽管我不确定其后果)。运行“sudo apt-get clean”后,我点击了“sudo nautilus /var/lib/dpkg/info”。在那里,我删除了与给我带来问题的软件包名称相关的每个文件(例如每个“python3.2”、“blender”和“yafaray”文件),并将它们备份到某些压缩文件中。之后,我点击了 apt-get update 和 apt-get upgrade。当它显示没有剩余升级时,我只需对 python3 和 python3.2 以及任何残留的冲突软件包(如 yafaray 和 blender)执行“sudo apt-get purge”。之后,我重新安装了 python3 和 python3.2 以及其他软件包。

似乎解决了我的问题,但这肯定不是最好的解决方案。如果其他人遇到与我相同的问题,请随时提交您的解决方案。

相关内容