我不确定这个问题是否与supervisord有关,但这是我尝试启动它时得到的结果。看起来有点像问题与Python2本身有关......
$ supervisord
Traceback (most recent call last):
File "/usr/bin/supervisord", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 700, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2230, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1815, in declare_namespace
path = sys.modules[parent].__path__
KeyError: 'zope'
我的记忆可能会让我背叛但是我想要记住它在我尝试启动另一个程序时发生在我身上,但我不记得哪个atm。 [1]
如果一个进程崩溃并自动重启,我使用supervisord进行监控,但如果它连续崩溃,它会放弃,我必须杀死supervisord并手动重新启动它。它曾经工作但不再工作。
编辑: [1]当我尝试发射炮弹时也会发生。
$ /var/www/bin/gunicorn -b 127.0.0.1:5000 index:app
Traceback (most recent call last):
File "/var/www/bin/gunicorn", line 5, in <module>
from pkg_resources import load_entry_point
File "/var/www/lib/python3.3/site-packages/pkg_resources.py", line 3027, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/var/www/lib/python3.3/site-packages/pkg_resources.py", line 741, in subscribe
callback(dist)
File "/var/www/lib/python3.3/site-packages/pkg_resources.py", line 3027, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/var/www/lib/python3.3/site-packages/pkg_resources.py", line 2514, in activate
list(map(declare_namespace, self._get_metadata('namespace_packages.txt')))
File "/var/www/lib/python3.3/site-packages/pkg_resources.py", line 2082, in declare_namespace
path = sys.modules[parent].__path__
KeyError: 'zope'
编辑2:似乎与此问题有关:https://bugs.launchpad.net/ubuntu/+source/zope.app.pagetemplate/+bug/851038 ...但我不知道该怎么办。 编辑编辑:好吧也许不是,它已经四十岁了。
是的我也使用Ubuntu Server。
答案 0 :(得分:2)
基于long discussion in chat,问题在于你已经弄乱了你的env,这样你的系统上的某些python安装就会变得混乱。
您的.bashrc
文件包含行export PYTHONPATH=/usr/local/lib/python3.3/dist-packages/
。但是,所有 Pythons都将使用此路径,即使是Python 2。
您使用apt安装了supervisor和gunicorn,这些版本使用python2。当你运行gunicorn
时,该命令使用python2,它会使用Python 3特定的东西来获取PYTHONPATH。沿线的某些东西试图检查路径并以某种方式混淆。
删除修改PYTHONPATH的.bashrc
文件中的行。