我正在使用 Ubuntu 14.04
安装的 pylint 有:
sudo apt-get install pylint
我在市场上下载了 eclipse luna 并安装了 pydev。但不是对我的代码进行 lint,而是对我的 python 运行时进行了 lint。
我的控制台输出:
PyLint: Executing command line: /usr/bin/pylint /home/devnull/pyworkspace/soup/test1.py
PyLint: The stdout of the command line is:
PyLint: The stderr of the command line is: File "/usr/lib/python3.4/site.py", line 182
file=sys.stderr)
^
SyntaxError: invalid syntax
我的配置:
知道我配置错了什么吗? 如果我从终端运行 pylint,一切正常。
更新我的终端输出:
No config file found, using default configuration
************* Module test1
C: 14, 0: Line too long (104/80) (line-too-long)
C: 14, 0: Exactly one space required after comma
return "{0}_{1}.html".format(date.today().strftime('%y_%m_%d'), str(uuid.uuid4()).replace('-','_'))
^ (bad-whitespace)
C: 25, 0: Line too long (112/80) (line-too-long)
C: 37, 0: Exactly one space required after comma
with codecs.open(os.path.join(path,filename()),'w',encoding='utf8') as f:
^ (bad-whitespace)
C: 37, 0: Exactly one space required after comma
with codecs.open(os.path.join(path,filename()),'w',encoding='utf8') as f:
^ (bad-whitespace)
C: 37, 0: Exactly one space required after comma
with codecs.open(os.path.join(path,filename()),'w',encoding='utf8') as f:
^ (bad-whitespace)
C: 1, 0: Missing module docstring (missing-docstring)
F: 3, 0: Unable to import 'bs4' (import-error)
F: 10, 0: Unable to import 'selenium' (import-error)
F: 11, 0: Unable to import 'selenium.webdriver.common.keys' (import-error)
C: 13, 0: Missing function docstring (missing-docstring)
C: 16, 0: Invalid constant name "path" (invalid-name)
C: 21, 0: Invalid constant name "driver" (invalid-name)
C: 30, 0: Invalid constant name "content" (invalid-name)
C: 33, 0: Invalid constant name "soup" (invalid-name)
W: 53,-1: String statement has no effect (pointless-string-statement)
W: 11, 0: Unused import Keys (unused-import)
Report
======
24 statements analysed.
Raw metrics
-----------
+----------+-------+------+---------+-----------+
|type |number |% |previous |difference |
+==========+=======+======+=========+===========+
|code |35 |79.55 |35 |= |
+----------+-------+------+---------+-----------+
|docstring |0 |0.00 |0 |= |
+----------+-------+------+---------+-----------+
|comment |1 |2.27 |1 |= |
+----------+-------+------+---------+-----------+
|empty |8 |18.18 |8 |= |
+----------+-------+------+---------+-----------+
**other output omitted **
PyLint --version:
No config file found, using default configuration
pylint 1.1.0,
astroid 1.0.1, common 0.61.0
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2]
我的运行时:
最佳答案
我刚遇到同样的问题。我使用 python 2.7 和 python 3.4 安装了 pylint
apt-get install pylint
我遇到了和你一样的错误。
然后我安装了
apt-get install pylint3
并将pylint可执行文件的位置更新为
/usr/bin/pylint3
它奏效了。
当你安装模块时,你需要定位你特定的 python 主版本号。
我必须对 numpy 和 scipy 等做同样的事情。
关于python - Eclipse 中的 PyLint,步骤 linting python 运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27892607/