我知道这个一般性问题并不新鲜,但这似乎是我个人的问题。
我尝试在 Windows 7 下为 Python 3.3 安装 pylint(是的,我知道它不受支持,但我知道这是可能的 - 因为我的一位同事做到了,但遗憾的是他对已知问题的解决方法不适用于我的电脑 - 并且他有 Windows 8 ...)
这个时候我已经安装了python 3.3,先尝试通过pip安装pylint,失败了。
搜索和与我的同事的一些谈话带来了这个答案: 没有运气 pip-installing pylint for Python 3
我设法按照这些说明安装了 pylint,但是其中一个依赖项(logilab-astng)失败了。
我检查了 setup.py 脚本并意识到“2to3”转换没有在我的机器上运行(我认为是由于路径问题) - 我重新配置了转换并且它运行了。
之后所有安装过程(pylint、logilab-astng、logilab-common)都退出“成功” - 但如果我启动 pylint,我会收到以下消息:
G:\Path\to\project>pylint --rcfile .\pylint.rc modulename
Traceback (most recent call last):
File "C:\Program Files (x86)\Python33\Scripts\pylint-script.py", line 9, in <module>
load_entry_point('pylint==0.27.0', 'console_scripts', 'pylint')()
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\__init__.py", line 21, in run_pylint
Run(sys.argv[1:])
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\lint.py", line 991, in __init__
linter.check(args)
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\lint.py", line 587, in check
self.check_astng_module(astng, walker, rawcheckers)
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\lint.py", line 666, in check_astng_module
walker.walk(astng)
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\utils.py", line 600, in walk
self.walk(child)
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\utils.py", line 597, in walk
cb(astng)
File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\checkers\variables.py", line 510, in visit_import
module = next(node.infer_name_module(parts[0]))
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\bases.py", line 304, in wrapped
for res in _func(node, context, **kwargs):
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\inference.py", line 181, in infer_imp
ort
yield self.do_import_module(name)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\mixins.py", line 117, in do_import_mo
dule
return mymodule.import_module(modname, level=level)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\scoped_nodes.py", line 342, in import
_module
return MANAGER.astng_from_module_name(absmodname)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\manager.py", line 136, in astng_from_
module_name
return self.astng_from_file(filepath, modname, fallback=False)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\manager.py", line 107, in astng_from_
file
return ASTNGBuilder(self).file_build(filepath, modname)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\builder.py", line 129, in file_build
node = self.string_build(data, modname, path)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\builder.py", line 135, in string_buil
d
module = self._data_build(data, modname, path)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\builder.py", line 162, in _data_build
module = self.rebuilder.visit_module(node, modname, package)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 616, in visit_mod
ule
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 616, in <listcomp
>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit
return self._visit_meths[cls](node, parent)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 471, in visit_fun
ction
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 471, in <listcomp
>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit
return self._visit_meths[cls](node, parent)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 450, in visit_for
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 450, in <listcomp
>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit
return self._visit_meths[cls](node, parent)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 540, in visit_if
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 540, in <listcomp
>
newnode.body = [self.visit(child, newnode) for child in node.body]
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit
return self._visit_meths[cls](node, parent)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 391, in visit_dis
card
newnode.value = self.visit(node.value, newnode)
File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 141, in visit
visit_method = getattr(self, visit_name)
AttributeError: 'TreeRebuilder3k' object has no attribute 'visit_yieldfrom'
我期待着你的想法!