Buenas tengo este c'odigo en python:
Código Python:
Ver originalfrom time
from threading import Thread
def myfunc(i):
print "sleeping 5 sec from thread %d" % i
time.sleep(5)
print "finished sleeping from thread %d" % i
for i in range(10):
t = Thread(target=myfunc, args=(i,))
t.start()
pero me devuelve este error:
Código:
Traceback (most recent call last):
File "./time.py", line 16, in <module>
import time
from threading import Thread
File "/usr/lib64/python2.7/threading.py", line 13, in <module>
from time import time as _time, sleep as _sleep
ImportError: cannot import name sleep
Creo que me falta la libreria, como ago para instalarla?? he provado pip pero no lo consigo...
Gracias!!