pylint 在 conda 环境中失败
pylint failing in conda environment
我无法在 conda 虚拟环境中获得 pylint
的基本用法。如果这还不受支持,我可以使用其他 linting 工具吗?
conda install pylint
pylint testfile.py
testfile.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
并且它可以正常工作。
我无法在 conda 虚拟环境中获得 pylint
的基本用法。如果这还不受支持,我可以使用其他 linting 工具吗?
conda install pylint
pylint testfile.py
testfile.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
并且它可以正常工作。