我使用以下命令安装了flake8
。
pip3 install flake8
从终端执行
flake8
会产生以下错误。Traceback (most recent call last):
File "/home/bilesh/.local/bin/flake8", line 11, in <module>
sys.exit(main())
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/main/cli.py", line 18, in main
app.run(argv)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/main/application.py", line 394, in run
self._run(argv)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/main/application.py", line 381, in _run
self.initialize(argv)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/main/application.py", line 365, in initialize
self.register_plugin_options()
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/main/application.py", line 206, in register_plugin_options
self.check_plugins.register_options(self.option_manager)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/plugins/manager.py", line 496, in register_options
list(self.manager.map(register_and_enable))
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/plugins/manager.py", line 302, in map
yield func(self.plugins[name], *args, **kwargs)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/plugins/manager.py", line 492, in register_and_enable
call_register_options(plugin)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/plugins/manager.py", line 404, in generated_function
return method(optmanager, *args, **kwargs)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/plugins/manager.py", line 221, in register_options
add_options(optmanager)
File "/home/bilesh/.local/lib/python3.6/site-packages/flake8/_pyflakes.py", line 79, in add_options
parser.config_options.extend(['builtins', 'doctests',
AttributeError: 'OptionManager' object has no attribute 'config_options'
从2016年发现了以下错误,但似乎已修复。
https://github.com/PyCQA/flake8-import-order/issues/79
不知道我是不是做错了什么。任何帮助都将不胜感激。
$ pip3 freeze | grep flake8
flake8==3.7.7
flake8-docstrings==1.3.0
flake8-polyfill==1.0.2
最佳答案
因此,根据phd对这个问题的评论,我做了以下事情。
卸载flake8:pip3 uninstall flake8
清除目录:sudo rm -R /path/to/directory/flake8
重新安装flake8:pip3 install flake8
它成功了:)
关于python - 运行flake8会给出-AttributeError:“OptionManager”对象没有属性“config_options”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55427406/