No module named 'softwareproperties'

在搞Ubuntu主题时用到了add-apt-repository,执行一直报错,报错内容如下:
Traceback (most recent call last):
File “/usr/bin/add-apt-repository”, line 10, in
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
ModuleNotFoundError: No module named ‘softwareproperties’

定位add-apt-repository,在目录/usr/bin目录下,打开发现这是用Python编写的,因为之前安装anaconda,把/usr/bin/python改掉了,换成了python3.6了,然后进入python3.6的解释器执行语句: from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler果断报错,如下:
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘softwareproperties’

然后进入python2.7的解释器在执行上述语句,报错如下:
Traceback (most recent call last):
File “”, line 1, in
ImportError: cannot import name shortcut_handler

原来是因为Python版本不同,Python的模块有些许的不同,正好我的系统里还装有Python3.5(这个是系统自带的),执行上述语句,结果如下:

from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
Traceback (most recent call last):
File “/usr/bin/lsb_release”, line 25, in
import lsb_release
ModuleNotFoundError: No module named ‘lsb_release’
Traceback (most recent call last):
File “/usr/bin/lsb_release”, line 25, in
import lsb_release
ModuleNotFoundError: No module named ‘lsb_release’

现在不报模块的错误了,那就直接将add-apt-repository中的第一行改为#!/usr/bin/python3.5 即可。

版权声明:本文为CSDN博主「蹦蹦跳跳的老蜗牛」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/MoMo_Goder/article/details/78125453

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值