Ubuntu17.04 执行add-apt-repository时报错No module named 'softwareproperties'
来源:互联网 发布:minecraft 1.8 mac 编辑:程序博客网 时间:2024/06/11 23:30
在搞Ubuntu主题时用到了add-apt-repository,执行一直报错,报错内容如下:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 10, in <module>
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 "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'softwareproperties'
然后进入python2.7的解释器在执行上述语句,报错如下:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 <module>
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in <module>
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
现在不报模块的错误了,那就直接将add-apt-repository中的第一行改为#!/usr/bin/python3.5 即可。
问题解决。
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 10, in <module>
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 "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'softwareproperties'
然后进入python2.7的解释器在执行上述语句,报错如下:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 <module>
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in <module>
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
现在不报模块的错误了,那就直接将add-apt-repository中的第一行改为#!/usr/bin/python3.5 即可。
问题解决。
阅读全文
0 0
- Ubuntu17.04 执行add-apt-repository时报错No module named 'softwareproperties'
- no add-apt-repository command
- Ubuntu执行apt-get upgrade报错ImportError: No module named 'ConfigParser'
- import theano时报错ImportError: No module named cPickle
- scrapy shell时报错 no module named win32api
- 使用yum安装软件时报错:No module named yum
- python脚本执行时报ImportError: No module named MySQLdb的处理
- 执行python脚本报错No module named requests解决方法
- ROS执行rosrun rqt_graph报错No module named 'catkin_pkg'
- 使用MySql时报错:Error loading MySQLdb module: No module named 'MySQLdb'
- 关于PyCharm导入自己写的module时报错:No Module Named XXX的解决方案
- 3DSlicer26:Add Extension/Module filepath,"no module named ..."
- 在用python操作mysql时报错:ModuleNotFoundError- No module named 'MySQLdb'
- 解决问题:启动Python时报“ImportError: No module named site”错误
- gdb时报“ImportError: No module named site”错误
- add-apt-repository 命令
- add-apt-repository
- add-apt-repository用法
- 【头条】销售易:搭起智能化的连接桥梁
- 读《编译原理》第九章,机器无关优化
- Linux查看物理CPU个数、核数、逻辑CPU个数
- 分布式系统架构网络之IDC机房
- Unity中射线的用法小结
- Ubuntu17.04 执行add-apt-repository时报错No module named 'softwareproperties'
- 对一个单向链表进行逆序
- 【LeetCode】627、Swap Salary
- Application.StartupPath和System.Environment.CurrentDirectory的区别
- [Arch] False Sharing ?
- stm32使用PWM时,关闭PWM引脚会出现高电平解决方案
- 【头条】为课堂教学插上智慧的翅膀 联想教育行业的探索和实践
- jdk源码解析(三)——OutOfMemory异常的实战
- 【软考之旅】第三章 操作系统