MacVimでは、次のコードをtest.pyとして保存します
print "Hello world! python2"
、これは明らかにpython3で間違っていますが、ファイルを保存するために:wを実行した後、エラーメッセージは表示されません。以下はSyntasticに関するすべての〜/ .vimrcの一部です。
" 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バージョンの構文を受け入れます。
インストール用にpython3
インストールする方法は、インストール自体がどのようにインストールされたかによって異なります。ただし、の使用に問題がない場合は除きますpip
。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加