简单记录一下,我在centos上安装supervisor启动时报错,下面是错误信息
[root@VM-0-10-centos vhost]# supervisord -c /etc/supervisord.d/supervisord.conf
Traceback (most recent call last):
File "/usr/bin/supervisord", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/python/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3260, in <module>
def _initialize_master_working_set():
File "/usr/local/python/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
f(*args, **kwargs)
File "/usr/local/python/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/python/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
ws.require(__requires__)
File "/usr/local/python/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/python/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'supervisor==3.4.0' distribution was not found and is required by the application
原因分析
由于我将服务器的python版本升级至3.10,而supervisord使用的还是2版本的python,因此启动报错
解决办法
编辑/usr/bin/supervisord文件,将首行python版本改为2,如下
#!/usr/bin/python2