【发布时间】:2015-04-30 10:13:13
【问题描述】:
我已经在我的笔记本电脑上安装了 KVM/QEMU/libvirt,并尝试使用 virt-manager 访问它。当我运行sudo virt-manager -c qemu:///system 时,出现以下错误:
Traceback (most recent call last):
File "/usr/share/virt-manager/virt-manager.py", line 399, in <module>
main()
File "/usr/share/virt-manager/virt-manager.py", line 256, in main
from virtManager import cli
File "/usr/share/virt-manager/virtManager/cli.py", line 29, in <module>
import libvirt
ImportError: No module named libvirt
我尝试更改 PYTHONPATH 并重新安装 virt-manager,但没有成功。我已经能够在 esxi 的 ubuntu vm 上成功安装 virt-manager 来管理另一台 KVM 主机,并且遵循相同的过程。谁能帮我解释一下?
【问题讨论】:
-
您的笔记本电脑默认使用哪个 Python 版本?
-
Python 2.7.5 (default, Mar 25 2015, 13:38:54) 92-g085f851+dfsg-2ubuntu4 [542 kB] │[GCC 4.8.2] on linux2 -
应该可以使用它。 libvirt 模块在包
python-libvirt中,是否安装了该包?您的系统上是否有文件/usr/lib/pyshared/python2.7/libvirtmod.so并且ldd /usr/lib/pyshared/python2.7/libvirtmod.so是否找到所有必需的库? -
python-libvirt已安装,但我似乎没有libvirtmod.so文件:willem ~ sudo apt-get install python-libvirt Reading package lists... Done Building dependency tree... 50% Building dependency tree Reading state information... Done python-libvirt is already the newest version. 0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade. willem ~ willem ~ ls /usr/lib/pyshared/python2.7/ | grep libvirtmod.so willem ~ ldd /usr/lib/pyshared/python2.7/libvirtmod.so ldd: /usr/lib/pyshared/python2.7/libvirtmod.so: No such file or directory -
如果您真的在运行 Ubuntu 12.04,那么系统中的软件包已损坏(有人删除了文件?文件系统损坏?)。根据Ubuntu Packages 的文件列表,该文件与软件包一起安装。您可以重新安装软件包以将其取回,但系统可能存在其他一些问题。您也可以通过
dpkg -L python-libvirt检查该文件是否与此软件包一起安装。
标签: python ubuntu-14.04 qemu kvm libvirt