AttributeError:模块“pylint”没有属性“checkers”

问题描述 投票:0回答:1

当我尝试导入

pylint.checkers
时,出现以下错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-d869f1bd3d2f> in <module>
----> 1 pl.checkers

AttributeError: module 'pylint' has no attribute 'checkers'

我在 Windows 10 系列 - 19041.630 上使用 Python 3.9.0(tags/v3.9.0:9cf6752,2020 年 10 月 5 日,15:34:40)[MSC v.1927 64 位 (AMD64)]IPython 7.19.0。安装的软件包:

argon2-cffi            20.1.0
astroid                2.4.2
async-generator        1.10
attrs                  20.3.0
auxlib                 0.0.43
backcall               0.2.0
bleach                 3.2.1
certifi                2020.11.8
cffi                   1.14.3
chardet                3.0.4
colorama               0.4.4
conda                  4.2.7
cryptography           3.2.1
cycler                 0.10.0
decorator              4.4.2
defusedxml             0.6.0
entrypoints            0.3
idna                   2.10
importlib-metadata     2.0.0
ipykernel              5.3.4
ipython                7.19.0
ipython-genutils       0.2.0
ipywidgets             7.5.1
isort                  5.6.4
jedi                   0.17.2
Jinja2                 2.11.2
jsonschema             3.2.0
jupyter                1.0.0
jupyter-client         6.1.7
jupyter-console        6.2.0
jupyter-core           4.7.0
jupyterlab-pygments    0.1.2
kiwisolver             1.3.1
lazy-object-proxy      0.0.0
MarkupSafe             1.1.1
matplotlib             3.3.3
mccabe                 0.6.1
mistune                0.8.4
Naked                  0.1.31
nbclient               0.5.1
nbconvert              6.0.7
nbformat               5.0.8
nest-asyncio           1.4.3
notebook               6.1.5
npyscreen              4.10.5
numpy                  1.19.3
packaging              20.4
pandocfilters          1.4.3
parso                  0.7.1
pickleshare            0.7.5
Pillow                 8.0.1
pip                    20.2.4
prometheus-client      0.9.0
prompt-toolkit         3.0.8
pycparser              2.20
Pygments               2.7.2
pylint                 2.6.1.dev1
pyparsing              2.4.7
PyQt5-sip              12.8.1
pyrsistent             0.17.3
python-dateutil        2.8.1
python-language-server 0.36.1
pywin32                300
pywinpty               0.5.7
PyX                    0.15
PyYAML                 5.3.1
pyzmq                  19.0.2
qdarkstyle             2.8.1
qtawesome              1.0.1
qtconsole              4.7.7
qtpy                   1.9.0
requests               2.25.0
scapy                  2.4.4
Send2Trash             1.5.0
setuptools             50.3.2
shellescape            3.8.1
six                    1.15.0
sphinx                 3.3.0
spyder                 5.0.0a1
spyder-kernels         1.9.4
terminado              0.9.1
testpath               0.4.4
toml                   0.10.2
toolz                  0.11.1
tornado                6.1
traitlets              5.0.5
urllib3                1.26.2
uuid                   1.30
watchdog               0.10.3
wcwidth                0.2.5
webencodings           0.5.1
wheel                  0.35.1
widgetsnbextension     3.5.1
windows-curses         2.2.0
winpython              3.0.20201028
wrapt                  1.12.1
zipp                   3.4.0

当我尝试

dir(pylint)
时,我得到:

In [8]: dir(pylint)
Out[8]:
['__all__',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__pkginfo__',
 '__spec__',
 '__version__',
 'run_epylint',
 'run_pylint',
 'run_pyreverse',
 'run_symilar',
 'sys']

另一个错误:当我安装 pylint 时,我收到以下警告:

astroid 2.4.2 requires lazy-object-proxy==1.4.*, but you'll have lazy-object-proxy 0.0.0 which is incompatible.

你能帮我吗?

python python-3.x pylint
1个回答
0
投票

问题已解决。我不知道为什么,但是:

>>> import pylint.checkers
>>> dir(pylint.checkers)
['BaseChecker', 'BaseTokenChecker', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'base_checker', 'initialize', 'register_plugins', 'table_lines_from_stats']

可能需要重新启动。

© www.soinside.com 2019 - 2024. All rights reserved.