Loading... <div class="tip share">请注意,本文编写于 1704 天前,最后修改于 1704 天前,其中某些信息可能已经过时。</div> ## 问题描述 使用supervisord启动应用时,supervisord报如下错误无法启动: ``` Apr 27 13:02:01 lx-redis-2 systemd: Starting Process Monitoring and Control Daemon... Apr 27 13:02:01 lx-redis-2 supervisord: Traceback (most recent call last): Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/bin/supervisord", line 5, in <module> Apr 27 13:02:01 lx-redis-2 supervisord: from pkg_resources import load_entry_point Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3251, in <module> Apr 27 13:02:01 lx-redis-2 supervisord: def _initialize_master_working_set(): Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside Apr 27 13:02:01 lx-redis-2 supervisord: f(*args, **kwargs) Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set Apr 27 13:02:01 lx-redis-2 supervisord: working_set = WorkingSet._build_master() Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_master Apr 27 13:02:01 lx-redis-2 supervisord: ws.require(__requires__) Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require Apr 27 13:02:01 lx-redis-2 supervisord: needed = self.resolve(parse_requirements(requirements)) Apr 27 13:02:01 lx-redis-2 supervisord: File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve Apr 27 13:02:01 lx-redis-2 supervisord: raise DistributionNotFound(req, requirers) Apr 27 13:02:01 lx-redis-2 supervisord: pkg_resources.DistributionNotFound: The 'supervisor==3.4.0' distribution was not found and is required by the application Apr 27 13:02:01 lx-redis-2 systemd: supervisord.service: control process exited, code=exited status=1 Apr 27 13:02:01 lx-redis-2 systemd: Failed to start Process Monitoring and Control Daemon. Apr 27 13:02:01 lx-redis-2 systemd: Unit supervisord.service entered failed state. Apr 27 13:02:01 lx-redis-2 systemd: supervisord.service failed. ``` ## 原因分析 由于服务器之前升级了默认python版本至3.8.1,而supervisord使用的还是2版本的python,因此启动报错 ## 问题处理 编辑`/usr/bin/supervisord`文件,将首行python版本改为2,如下 ``` #!/usr/bin/python2 ``` 最后修改:2020 年 04 月 27 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 1 如果觉得我的文章对你有用,请随意赞赏