在 ubuntu 18.04 中,当我通过以下命令将默认 python 从 python 3.6 更改为其他版本时:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
或者当我删除 python 3.6 并安装其他版本netplan apply
不起作用并导致此错误:
File "/usr/sbin/netplan", line 20, in <module>
from netplan import Netplan
File "/usr/share/netplan/netplan/__init__.py", line 18, in <module>
from netplan.cli.core import Netplan
File "/usr/share/netplan/netplan/cli/core.py", line 24, in <module>
import netplan.cli.utils as utils
File "/usr/share/netplan/netplan/cli/utils.py", line 25, in <module>
import netifaces
ModuleNotFoundError: No module named 'netifaces'
并且命令pip install netifaces
有一些错误。