user2956843
user2956843

Reputation: 187

import libvirt in python but ImportError on Ubuntu

My os is Ubuntu 12.04. I install the kvm virt-manager and python. I want to use python code to control the vm on kvm. but my code import libvirt has something wrong...

Here is my code :

import libvirt
import time
import threading
import paramiko
import os
import commands
import signal

numVM = 1
hostname=['VM-01']
port=22
VMLoadAve={}
def monitor():
     ..... 
     while True:
         monitor() 
         time.sleep(MAXDURATION)

Traceback (most recent call last): File "test1.py", line 1, in import libvirt ImportError: No module named libvirt

I have installed the python-libvirt, libvirt-bin what other reasons may do this happened?
I am a newest for this. thanks for your help ~ :)

Upvotes: 1

Views: 6763

Answers (1)

DanielB
DanielB

Reputation: 2826

For the sake of historicaly record, 'python-libvirt' is the correct deb package for the python 2 binding, while python3-libvirt gives you the corresponding python 3 binding to libvirt.

Upvotes: 4

Related Questions