也许有人对这一个有所了解。谷歌,Logilab.org档案以及我试图确定解决方案的所有其他来源都显得空洞。
我试图在Windows上使用Eclipse中的PyDev(使用Python 2.6)运行Pylint 2.4,但是现在我很乐意只运行pylin。我使用easy_install来安装pylint并且它是依赖的。这似乎工作正常。但是,如果我尝试运行c:\ python26 \ Scripts \ pylint.bat,我会得到以下内容:
Traceback (most recent call last):
File "C:\Python26\Scripts\pylint", line 5, in <module>
pkg_resources.run_script('pylint==0.24.0', 'pylint')
File "c:\Python26\lib\site-packages\pkg_resources.py", line 489, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "c:\Python26\lib\site-packages\pkg_resources.py", line 1207, in run_script
execfile(script_filename, namespace, namespace)
File "c:\python26\lib\site-packages\pylint-0.24.0-py2.6.egg\EGGINFO\scripts\pylint", line 3, in <module>
from pylint import lint
File "c:\Python26\lib\site-packages\pylint-0.24.0-py2.6.egg\pylint\lint.py", line 31, in <module>
from pylint.checkers import utils
File "c:\Python26\lib\site-packages\pylint-0.24.0py2.6.egg\pylint\checkers\__init__.py", line 44, in <module>
from logilab.astng.utils import ASTWalker
File "c:\Python26\lib\site-packages\logilab_astng-0.22.0py2.6.egg\logilab\astng\__init__.py", line 58, in <module>
from logilab.astng.nodes import *
File "c:\Python26\lib\site-packages\logilab_astng-0.22.0-py2.6.egg\logilab\astng\nodes.py", line 54, in <module>
from logilab.astng.node_classes import Arguments, AssAttr, Assert, Assign, \
File "c:\Python26\lib\site-packages\logilab_astng-0.22.0-py2.6.egg\logilab\astng\node_classes.py", line 27, in <module>
from logilab.astng.bases import (NodeNG, Statement, Instance, InferenceContext,
File "c:\Python26\lib\site-packages\logilab_astng-0.22.0-py2.6.egg\logilab\astng\bases.py", line 28, in <module>
from logilab.common.compat import builtins
ImportError: cannot import name builtins
我四处乱逛并调查了based.py,但我不知道问题是什么。我的shell路径包括C:\ python26; c:\ Python26 \ Scripts。
这与lib2to3有关吗?还是Python 2.6兼容性?
请注意,我使用“easy_install pylint”安装了pylint,而logilab-common最新为0.56.2。
谢谢!
答案 0 :(得分:1)
对我来说,我的site-packages文件夹中有一个logilab.common.compat模块,它隐藏在egg“logilab.pylintinstaller-0.15.2-py2.6.egg”中。安装了logilab_common鸡蛋后,删除了pylintinstaller egg,使得pylint在eclipse中工作。我通过IPython发现了这一点:
In [37]: import logilab.common.compat
In [38]: from logilab.common.compat import builtins
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
C:\Users\Rio\Documents\mcedit\pymclevel\<ipython console> in <module>()
ImportError: cannot import name builtins
In [41]: logilab.common.compat.__file__
Out[41]: 'c:\\python26\\lib\\site-packages\\logilab.pylintinstaller-0.15.2-py2.6.egg\\logilab\\common\\compat.pyc'
答案 1 :(得分:0)
可能你没有logilab.common软件包,或者安装的版本是旧软件包。
尝试:
easy_install-2.6 --upgrade logilab-common