在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']
如何让Syntastic在我在终端运行test.py时检测到这种类型的错误: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 安装?我认为这是关键。 - ivan_pozdeev