简体   繁体   中英

python NameError: global name 'multiprocessing' is not defined

I am trying to convert my threaded code to multiprocessing code. but it is giving me error

    Name Error: global name 'multiprocessing' is not defined

Multiprocessing is installed and I imported it by

    from multiprocessing import *

With your import, you will import everything inside the multiprocessing module. I assume that you are making a call that looks something like

multiprocessing.some_function()

but since you've imported everything inside multiprocessing , it will not be in your namespace. I recommend that you do import multiprocessing and use that as your point of entry to not clutter your namespace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM