在Ubuntu20.4中类似下方python文件运行时找不到module,但在本地能找到这个module时,可以修改报错文件中的#!/usr/bin/python3.8
。将其改为对应Ubuntu版本默认的python版本(Ubuntu20.4默认的Python版本是3.8),不要随意修改,只改变/usr/bin/文件夹下python的软连接是没用的。
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 12, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
ModuleNotFoundError: No module named 'softwareproperties'
sudo apt-get update
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
命中:2 http://security.ubuntu.com/ubuntu focal-security InRelease
命中:3 https://linux.teamviewer.com/deb stable InRelease
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
ModuleNotFoundError: No module named 'CommandNotFound'
正在读取软件包列表... 完成
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