简体   繁体   中英

Import multiprocessing fails in python 2.7

I've got strange error from python console:

>>> import multiprocessing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\multiprocessing\__init__.py", line 65, in <module>
    from multiprocessing.util import SUBDEBUG, SUBWARNING
  File "C:\Python27\lib\multiprocessing\util.py", line 300, in <module>
    atexit.register(_exit_function)
AttributeError: 'module' object has no attribute 'register'

Repairing python via Uninstaller options doesn't help. Any ideas what's going on? This incident happened after unusual termination of script with using multiprocessing. Python is 32-bit version, Windows 7 x64.

UPDATE: Full reinstallation helps.

What happens if you try this?

>>> import atexit
>>> atexit.__file__  # should display a similar path for you
'C:\\python27\\lib\\atexit.pyc'
>>> dir(atexit)  # should display the same list, including "register"
['__all__', '__builtins__', '__doc__', '__file__',
 '__name__', '__package__', '_exithandlers', '_run_exitfuncs',
 'register', 'sys']

It looks like your atexit module got damaged. Fixing that may just be a matter of deleting atexit.pyc (if it exists).

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