微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐