我在CentOS中运行ngxtop(查看nginx日志):找不到config_parser
[XXX ~]# /usr/local/python3/bin/ngxtop
Traceback (most recent call last):
File "/usr/local/python3/bin/ngxtop", line 6, in <module>
from ngxtop.ngxtop import main
File "/usr/local/python3/lib/python3.6/site-packages/ngxtop/ngxtop.py", line 77, in <module>
from config_parser import detect_log_config, detect_config_path, extract_variables, build_pattern
ModuleNotFoundError: No module named 'config_parser'
解决方法:
1、获得另外一个已经修复的官方版本;
2、ngxtop所有内部模块都喜欢utils
或config_parser
需要加上前缀ngxtop.
,比如from ngxtop.utils import ...
3、获取另外已修复的官方版本方法,
克隆git repo并从中安装它,如果你需要开始:
git clone https://github.com/lebinh/ngxtop
cd ngxtop
pip install .