2017-09-13 70 views
0

我想在python2.7使用多输入多进程,但是当我输入多进程它给了我下面的错误:得到错误与python2.7

Traceback (most recent call last): 
    File "threading.py", line 25, in <module> 
    import multiprocess 
    File "C:\Python27\lib\site-packages\multiprocess\__init__.py", line 65, in 
<module> 
    from multiprocess.util import SUBDEBUG, SUBWARNING 
    File "C:\Python27\lib\site-packages\multiprocess\util.py", line 349, in 
<module> 
    class ForkAwareLocal(threading.local): 
AttributeError: 'module' object has no attribute 'local' 
Exception AttributeError: "'module' object has no attribute '_shutdown'" in 
<module 'threading' from 'C:\Users\gjavadi\Documents\P 
    yhton_workspace\threading.py'> ignored 

我的代码基本上是一条线:

import multiprocess 

我使用'pip install multiprocess'安装了软件包。你能帮我弄清楚这个问题吗?

+1

您的意思是多处理?这是一个标准模块。它不需要点子安装。 –

+0

你在你的项目中使用'threading.py'吗? _'C:\用户\ gjavadi \文档\ Pyhton_workspace \ threading.py'_。 – stovfl

+0

现在我有一个奇怪的情况。无论我运行的是什么python文件,都给了我同样的错误。我卸载了我的python并重新安装了它,但是现在好像有'导入'问题,我不知道如何解决这个问题。我不断收到相同的错误消息 “模块”对象没有属性“本地”。请帮帮我。 – Gol

回答

1

你可以试试这个:

>>> 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'] 

它看起来像你的AtExit模组损坏了。修复这可能只是删除atexit.pyc(如果存在)的问题。

〜蒂姆彼得斯

+0

我这样做了,但我又得到了同样的错误。 – Gol

0

我终于想通了我的问题。问题在于与python具有相同的文件名。我将我的文件命名为“threading.py”,其中python具有相同名称的文件。