python ImportError:无法导入名称process_or_group_name

问题描述 投票:1回答:2

我刚刚遇到了一个奇怪的主管导入问题如下:

:~# /usr/local/bin/supervisorctl status
Traceback (most recent call last):
  File "/usr/local/bin/supervisorctl", line 7, in <module>
    from supervisor.supervisorctl import main
  File "/usr/local/lib/python2.7/dist-packages/supervisor/supervisorctl.py", line 36, in <module>
    from supervisor.options import ClientOptions
  File "/usr/local/lib/python2.7/dist-packages/supervisor/options.py", line 23, in <module>
    from supervisor.datatypes import process_or_group_name
ImportError: cannot import name process_or_group_name

然后我试着用ipython运行它:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/usr/local/lib/python2.7/dist-packages/supervisor/options.py in <module>()
     24 from supervisor.medusa import asyncore_25 as asyncore
     25
---> 26 from supervisor.datatypes import process_or_group_name
     27 from supervisor.datatypes import boolean
     28 from supervisor.datatypes import integer

ImportError: cannot import name process_or_group_name
> /usr/local/lib/python2.7/dist-packages/supervisor/options.py(26)<module>()
     25
---> 26 from supervisor.datatypes import process_or_group_name
     27 from supervisor.datatypes import boolean

ipdb> supervisor.datatypes.__file__
'/usr/lib/python2.7/dist-packages/supervisor/datatypes.pyc'
ipdb> sys.path
['/usr/local/lib/python2.7/dist-packages/supervisor', '', '/usr/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/IPython/extensions']

奇怪的部分是sys.path说

'/usr/local/lib/python2.7/dist-packages' 

'/usr/lib/python2.7/dist-packages'

但该程序实际上正在使用

'/usr/lib/python2.7/dist-packages/supervisor/datatypes.pyc'

代替

'/usr/local/lib/python2.7/dist-packages/supervisor/datatypes.pyc'

导致这个问题,我真的不明白。请帮忙。

提前致谢。

python-2.7 supervisor
2个回答
0
投票

刚刚遇到过同样的错误信息,并通过运行更新来解决它:

apt update

这在服务器上很长时间没有运行,并且更新了许多不同的软件包。主管仍然无法正常工作,但卸载后再安装一切正常,主管成功启动

apt remove supervisor
apt install supervisor

0
投票

easy_install做到了这一点。虽然不知道如何以及为什么:-)

easy_install supervisor
© www.soinside.com 2019 - 2024. All rights reserved.