首页 > 解决方案 > 在 Sublime Text 3 上使用 `flake8` 进行 linting 出现问题

问题描述

我一直没有成功尝试SublimeLinter-flake8在我的 Xubuntu 笔记本电脑上使用它。我通过 Anaconda 发行版以及flake8软件包安装了 Python 3.7.7。我还在为 Sublime Text 3 使用 Anaconda IDE 插件,并关闭了 Anaconda 的 linting。

但是每当我输入一些 Python 代码时,我都会收到相同的错误消息:

SublimeLinter: #1 flake8 <untitled 25> ERROR:
=============================================

Traceback (most recent call last):
  File "/home/srdjan/anaconda3/bin/flake8", line 11, in <module>
    load_entry_point('flake8==3.7.7', 'console_scripts', 'flake8')()
  File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2714, in load_entry_point
    return ep.load()
  File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2332, in load
    return self.resolve()
  File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2338, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/srdjan/anaconda3/lib/python3.7/site-packages/flake8/main/cli.py", line 2, in <module>
    from typing import List, Optional
  File "/home/srdjan/anaconda3/lib/python3.7/site-packages/typing.py", line 1347, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/home/srdjan/anaconda3/lib/python3.7/site-packages/typing.py", line 1003, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry

奇怪的是,我在使用SublimeLinter-pycodestyleand时遇到了一些类似的问题SublimeLinter-pyflakes,哪里pyflakes会不断抛出这些奇怪的错误消息。我永远无法让它工作。

既然我已经拥有及其随附的插件pycodestyle,我是否应该pyflakes从我的笔记本电脑上卸载?flake8SublimeLinter-flake8

标签: pythonpython-3.xsublimetext3flake8linter

解决方案


推荐阅读