vim – 如何设置Syntastic作为python3检查器而不是python2

前端之家收集整理的这篇文章主要介绍了vim – 如何设置Syntastic作为python3检查器而不是python2前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在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的内置工具来解析代码 so it accepts syntax for the Python version that it belongs to.

如何为python3安装安装它取决于安装本身的安装方式 – unless you’re fine with using pip.

原文链接:https://www.f2er.com/bash/384263.html

猜你在找的Bash相关文章