无法在Debian上安装Telegram:ModuleNotFoundError:没有名为' apt_pkg'

时间:2018-05-24 06:59:42

标签: linux telegram apt

我是Debian用户。

我在shell中以root身份运行代码:

我想用以下命令安装电报:

sudo add-apt-repository ppa:atareao/telegram

sudo apt-get update

sudo apt-get install telegram

我收到以下错误:

    Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
    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 <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

我该如何解决?

由于

2 个答案:

答案 0 :(得分:2)

在debian上安装telegram

1)telegram包可以通过snap安装。

# apt install snapd

要查找包裹:

snap find telegram

示例输出:

Name                 Version     Developer       Notes  Summary
telegram-sergiusens  1.2.6       sergiusens      -      Telegram desktop client
telegram-cli         1.4.5       marius-quabeck  -      Command-line interface for Telegram. Uses the readline interface.
telegram-desktop     1.2.17      3v1n0           -      Official desktop client for the Telegram messenger
ubuntu-social-kit    3           keshavnrj       -      Bring social media apps to Ubuntu Desktop
squirrelbot          1.1.2       xordspar0       -      A Telegram bot that stashes away links that you send it
mup-plugins          2017.04.19  niemeyer        -      mup IRC and Telegram bot - plugins side
mup-accounts         2016.09.24  niemeyer        -      mup IRC and Telegram bot - account connection side
shell2telegram       1.7         msoap           -      Telegram bot constructor from command-line

安装telegram

# snap install telegram-desktop

2)stretch-backports上提供了telegram-desktop个包。通过添加以下行来修改/etc/apt/sources.list

deb http://deb.debian.org/debian/ stretch-backports main

保存然后运行:

# apt update
# apt install telegram-desktop

这个包也适用于debian Buster和Sid。

删除ppa:atareao/telegram(在/etc/apt/sources.list.d/下)并查看@aicastell关联的the answer以修正错误。

答案 1 :(得分:1)

为什么要从PPA下载并安装电报?!
跟我来:
1)Telegram.Org下载电报桌面 2)将档案提取到/ opt
3)执行/ opt / Telegram / Telegram

注意:Telegram应用程序会自动在应用程序菜单上安装telegramdesktop.desktop文件(〜/ .local / share / applications / telegramdesktop.desktop)。下次只点击图标。

精细。