Another option is to use the
psutil library, which always turn out useful in these situations:
>>> import psutil
This should work on any platform supported by
psutil(Unix and Windows).
Note that in some occasions
multiprocessing.cpu_count may raise a
psutil will be able to obtain the number of CPUs. This is simply because
psutil first tries to use the same techniques used by
multiprocessing and, if those fail, it also uses other techniques.