diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index 16f00d8edf17..74e2c51f600c 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -355,10 +355,9 @@ def single_compile(args): if len(build) > 1 and jobs > 1: # build parallel - import multiprocessing.pool - pool = multiprocessing.pool.ThreadPool(jobs) - pool.map(single_compile, build_items) - pool.close() + from concurrent.futures import ThreadPoolExecutor + with ThreadPoolExecutor(jobs) as pool: + pool.map(single_compile, build_items) else: # build serial for o in build_items: