首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置python3 3-aptdaemon时的SyntaxError

设置python3 3-aptdaemon时的SyntaxError
EN

Ask Ubuntu用户
提问于 2019-07-31 11:50:09
回答 3查看 3.9K关注 0票数 1

大家好。在进行故障排除的同时,我创建了新的问题。请参阅下面的链接

如何重新安装APT软件包

重新安装的结果:

代码语言:javascript
复制
$ sudo apt install --reinstall python3-aptdaemon
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for python3-aptdaemon:amd64
ariel@ariel:~$ sudo apt install --reinstall python3-aptdaemon
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for python3-aptdaemon:amd64

关于pkg的另一个结果:用于更新。

代码语言:javascript
复制
$ sudo apt-get update

Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                           
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                         
Hit:4 http://ppa.launchpad.net/diesch/testing/ubuntu bionic InRelease                                  
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                            
Ign:6 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease              
Err:7 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release                 
  404  Not Found [IP: 91.189.95.83 80]
Traceback (most recent call last):                                                   
  File "/usr/lib/cnf-update-db", line 8, in 
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in 
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in 
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in 
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in 
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in 
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in 
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in 
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in 
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code 

更新的解决方案产出:

代码语言:javascript
复制
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python3 (python3) in auto mode
ariel@ariel:/etc/apt/sources.list.d

$ sudo update-alternatives --config python3

There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/bin/python3.6
Nothing to configure.
ariel@ariel:/etc/apt/sources.list.d$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu19.1) ...
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1570
    async = reply_handler and error_handler
          ^
SyntaxError: invalid syntax

dpkg: error processing package python3-aptdaemon (--configure):
 installed python3-aptdaemon package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-aptdaemon.gtk3widgets:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19.1); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing package python3-aptdaemon.gtk3widgets (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of language-selector-gnome:
 language-selector-gnome depends on python3-aptdaemon.gtk3widgets; however:
  Package python3-aptdaemon.gtk3widgets is not configured yet.

No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: error processing package language-selector-gnome (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on language-selector-gnome; however:
  Package language-selector-gnome is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python3-aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)
ariel@ariel:/etc/apt/sources.list.d$ 

每当我试图安装任何软件时,都会出现以下错误。我试过sudo apt-get install -f,但它输出

代码语言:javascript
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu19.1) ...
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1570
    async = reply_handler and error_handler
          ^
SyntaxError: invalid syntax

dpkg: error processing package python3-aptdaemon (--configure):
 installed python3-aptdaemon package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-aptdaemon.gtk3widgets:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19.1); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing package python3-aptdaemon.gtk3widgets (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of language-selector-gnome:
 language-selector-gnome depends on python3-aptdaemon.gtk3widgets; however:
  Package python3-aptdaemon.gtk3widgets is not configured yet.

dpkg: error processing package language-selector-gnome (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on language-selector-gnome; however:
  Package language-selector-gnome is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python3-aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt clean && sudo apt autoclean && sudo apt remove && sudo apt autoremove -y && sudo apt install -f && sudo dpkg --configure -a && sudo apt update && sudo apt full-upgrade

代码语言:javascript
复制
[sudo] password for ariel: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu19.1) ...
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1570
    async = reply_handler and error_handler
          ^
SyntaxError: invalid syntax

dpkg: error processing package python3-aptdaemon (--configure):
 installed python3-aptdaemon package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-aptdaemon.gtk3widgets:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19.1); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing package python3-aptdaemon.gtk3widgets (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of language-selector-gnome:
 language-selector-gnome depends on python3-aptdaemon.gtk3widgets; however:
  Package python3-aptdaemon.gtk3widgets is not configured yet.

dpkg: error processing package language-selector-gnome (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on language-selector-gnome; however:
  Package language-selector-gnome is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leavinNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                                       No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                   No apport report written because MaxReports is reached already
                   g unconfigured
Errors were encountered while processing:
 python3-aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)

EN

回答 3

Ask Ubuntu用户

发布于 2019-07-31 12:23:18

这是因为Python3版本不兼容。您已经安装了PythonVersion3.7.3并使其成为默认版本。18.04仿生海狸中Python 3的默认版本是3.6.8。您需要切换回3.6.8版本。要做到这一点,请运行

代码语言:javascript
复制
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --config python3

然后输入1。

相关的bug报告:

票数 3
EN

Ask Ubuntu用户

发布于 2020-02-07 10:31:16

我今天偶然看到了这个问题。似乎异步已经被添加为3.6.8到3.6.9之间的一个功能符号(这太荒谬了--这种事情不应该在补丁级别之间改变)。我必须编辑/usr/lib/python3/dist-packages/aptdaemon/client.py并用不同的变量名替换每次出现的“异步”(我只是附加了一个字符)。在此之后,我的系统能够再次安装所有丢失的软件包。

因此,真正的罪魁祸首似乎是Python3中的变化,它似乎超出了版本更改的范围。

票数 2
EN

Ask Ubuntu用户

发布于 2019-12-09 09:48:32

以下命令适用于我:

代码语言:javascript
复制
sudo apt-get remove python3-apt
sudo apt-get install python3-apt
sudo apt remove python3-aptdaemon
sudo apt install python3-aptdaemon
票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1162377

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档