Trong MacVim, tôi lưu sau mã như test.pyLàm thế nào để thiết lập Syntastic như kiểm tra python3 thay vì python2
print "Hello world! python2"
, mà rõ ràng là sai với python3, nhưng sau khi tôi chạy: w để lưu các tập tin , không có thông báo lỗi cho nó, Sau đây là một phần của ~/vimrc, đó là tất cả về 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']
làm thế nào để làm cho Syntastic phát hiện loại hình này lỗi như tôi chạy test.py trong Terminal :
NingGW:Desktop ninggw$ python3 test.py
File "test.py", line 1
print "Hello world! python2"
^
SyntaxError: Missing parentheses in call to 'print'
Tiếp theo là gì: SyntasticInfo nói:
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
nào cài đặt Python không của bạn 'flake8' thuộc về? Tôi nghĩ đây là chìa khóa. –