ImportError:在python 3.6 下没有名为'config_parser'的模块

我在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所有内部模块都喜欢utilsconfig_parser需要加上前缀ngxtop.,比如from ngxtop.utils import ...

3、获取另外已修复的官方版本方法,克隆git repo并从中安装它,如果你需要开始:

git clone https://github.com/lebinh/ngxtop
cd ngxtop
pip install .
Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [32 lines of output] <string>:19: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. <string>:45: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. Traceback (most recent call last): File "C:\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module> main() File "C:\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out[&#39;return_val&#39;] = hook(**hook_input[&#39;kwargs&#39;]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-cjqwq8gg\overlay\Lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-cjqwq8gg\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires self.run_setup() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-cjqwq8gg\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-cjqwq8gg\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 793, in <module> File "<string>", line 760, in setup_package File "C:\Users\Administrator\AppData\Local\Temp\pip-install-j392jeuh\pandas_1ec0376bb4a64dd1ae12a3aacc9b598c\versioneer.py", line 1439, in get_version return get_versions()["version"] ^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-install-j392jeuh\pandas_1ec0376bb4a64dd1ae12a3aacc9b598c\versioneer.py", line 1368, in get_versions cfg = get_config_from_root(root) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-install-j392jeuh\pandas_1ec0376bb4a64dd1ae12a3aacc9b598c\versioneer.py", line 400, in get_config_from_root parser = configparser.SafeConfigParser() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module &#39;configparser&#39; has no attribute &#39;SafeConfigParser&#39;. Did you mean: &#39;RawConfigParser&#39;? [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. [notice] A new release of pip is available: 24.2 -> 25.1.1 [notice] To update, run: python.exe -m pip install --upgrade pip error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
最新发布
06-07
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值