python 添加-apt-存储库 : ImportError: No module named 'apt_pkg'

标签 python importerror apt

当我尝试时:

sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next

在 Ubuntu 中,终端显示此错误消息:

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
ImportError: No module named 'apt_pkg'

我有两个版本的 python,一个是 2.7,另一个是 3.5。

如何在python3.5上安装这个包?

最佳答案

我有一些与此完全不同的东西。我的失败了

No module named 'softwareproperties'

我的解决方案是:

sudo vim /usr/bin/add-apt-repository
Change package header from `python3` to `python3.4` (or lower)

当您最近升级添加另一个python3包时,可能会发生这种情况。

关于python 添加-apt-存储库 : ImportError: No module named 'apt_pkg' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42386097/

相关文章:

python - PyTorch : How to apply the same random transformation to multiple image?

python - 检查self是否是python中子类的实例

linux - 如何找出谁在调用 apt-get?

python - 解释通过串行端口接收到的字节

python - 带有参数的 pyspark foreach

python - 导入错误 : cannot import name timezone pythonanywhere

python - 导入错误 : ephem/_libastro. 所以 undefined symbol :PyUnicodeUCS2_AsUTF8String

python-2.7 - Python : Can't import a function from another. py 文件

json - 如何解决在 c++ 文件中包含 json-glib.h 的问题

node.js - 在 Ubuntu 14.04 上安装最新版本的 npm(值得信赖)