这个非常简单的代码:
#!/usr/bin/python3
print('foo', end='')
让Pylint不高兴(在Python2和Python3上都有):
pylint ./pylint.py
No config file found, using default configuration
************* Module pylint
E: 2, 0: invalid syntax (syntax-error)
为什么?
答案 0 :(得分:4)
运行pylint时出现此错误。但我的pylint只支持python2。所以它错了:
$ pylint foo.py
No config file found, using default configuration
************* Module foo
E: 2, 0: invalid syntax (syntax-error)
所以我做了pip3 install pylint
。
然后一切正常(或者至少它超过了语法错误):
$ python3 -m pylint foo.py | head
No config file found, using default configuration
************* Module foo
C: 1, 0: Black listed name "foo" (blacklisted-name)
C: 1, 0: Missing module docstring (missing-docstring)
.....
有关python2和3的pylint的详细信息,请参阅此处:https://askubuntu.com/questions/340940/installing-pylint-for-python3-on-ubuntu