在 MacVim 中,我将以下代码保存为 test.py
print "Hello world! python2"
,这对于 python3 来说显然是错误的,但是
我运行 :w 保存文件后,没有错误消息,
以下是 ~/.vimrc 的一部分,都是关于 Syntastic 的:
" Syntastic
"" Recommended settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
"" Display checker-name for that error-message
let g:syntastic_aggregate_errors = 1
"" I use the brew to install flake8
let g:syntastic_python_checkers=['flake8', 'python3']
当我在终端中运行 test.py 时,如何让 Syntastic 检测到此类错误:
NingGW:Desktop ninggw$ python3 test.py
File "test.py", line 1
print "Hello world! python2"
^
SyntaxError: Missing parentheses in call to 'print'
以下是 :SyntasticInfo 所说的:
Syntastic version: 3.8.0-10 (Vim 800, Darwin, GUI)
Info for filetype: python
Global mode: active
Filetype python is active
The current file will be checked automatically
Available checkers: flake8 python
Currently enabled checker: flake8
Press ENTER or type command to continue
flake8
是一个Python包。它使用Python的内置工具来解析代码,所以它接受它所属的Python版本的语法 http://flake8.pycqa.org/en/latest/.
如何为您安装它python3
安装取决于安装本身的安装方式 -除非你习惯使用pip http://flake8.pycqa.org/en/latest/.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)