Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using multiprocessing in Python ends in ImportError

Tags:

python

I'm trying to run simple programs from Python doc using multiprocessing, however I always get errors like:

Traceback (most recent call last):                               
  File "Poolexample.py", line 1, in <module>
    from multiprocessing import Pool
ImportError: cannot import name Pool

or similarly, cannot import name Process. Anyone knows why does Python send me such errors?

like image 675
Igor Jurkowski Avatar asked Nov 13 '22 22:11

Igor Jurkowski


1 Answers

As @ahojnnes said, multiprocessing was introduced in Python 2.6. So, be sure to use Python 2.6+ if you need this module with painless integration.

However, you could use python-multiprocessing, which is a backport of multiprocessing for Python 2.4 and 2.5.

like image 93
orftz Avatar answered Dec 27 '22 11:12

orftz