gpt4 book ai didi

python - pylint 在 conda 环境中失败

转载 作者:行者123 更新时间:2023-11-28 16:28:33 25 4
gpt4 key购买 nike

我无法在 conda 虚拟环境中获得 pylint 的基本用法。如果这还不受支持,我可以使用其他 linting 工具吗?

conda install pylint
pylint testfile.py

测试文件.py:

#!/usr/bin/env python
print("hello, world")

pylint路径:

$ which pylint
/home/me/anaconda3/envs/myenv/bin/pylint

$ conda list | grep pylint
pylint 1.4.2 py35_0 defaults

回溯:

No config file found, using default configuration
Traceback (most recent call last):
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/pylint/lint.py", line 892, in get_ast
return MANAGER.ast_from_file(filepath, modname, source=True)
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/manager.py", line 111, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/builder.py", line 134, in file_build
module = self._data_build(data, modname, path)
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/builder.py", line 177, in _data_build
module = rebuilder.visit_module(node, modname, node_file, package)
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/rebuilder.py", line 146, in visit_module
newnode.body = [self.visit(child, newnode) for child in node.body]
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/rebuilder.py", line 146, in <listcomp>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/rebuilder.py", line 159, in visit
return self._transform(visit_method(node, parent))
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/rebuilder.py", line 407, in visit_discard
newnode.value = self.visit(node.value, newnode)
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/rebuilder.py", line 159, in visit
return self._transform(visit_method(node, parent))
File "/home/me/anaconda3/envs/myenv/lib/python3.5/site-packages/astroid/rebuilder.py", line 311, in visit_callfunc
if node.starargs is not None:
AttributeError: 'Call' object has no attribute 'starargs'
************* Module testfile
F: 1, 0: <class 'AttributeError'>: 'Call' object has no attribute 'starargs' (astroid-error)

https://bitbucket.org/logilab/pylint/issues/643/attributeerror-call-object-has-no

最佳答案

此问题已在 Bitbucket 的上游得到修复,代码已渗透到 pip,但尚未渗透到 Conda。现在用 pip 安装它。

conda uninstall -y pylint
pip install --no-input pylint

[编辑] pylint 包已在 Continuum 存储库中更新,您现在可以使用 Conda 和 Python 3.5 安装 pylint 并且它可以毫无问题地运行。

关于python - pylint 在 conda 环境中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34445171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com