平时用的 sublime + sublimelinter + sublimelinter-pyflakes 来进行代码的格式检测 但是突然发现 python 的新语法 f"hello {name}" 会被检查出 syntax error 打开调试界面看了一下发现了这么一段
SublimeLinter: find_python(version=None, script='flake8', module=None)
SublimeLinter: find_python: default python = /usr/bin/python
SublimeLinter: find_python: available version = {'minor': 7, 'major': 2}
SublimeLinter: find_python: 'flake8' path = /usr/local/bin/flake8
SublimeLinter: find_python: <= ('/usr/bin/python', '/usr/local/bin/flake8', 2, 7)
SublimeLinter: flake8 version query: /usr/bin/python /usr/local/bin/flake8 --version
虽然上面这个是 flake8 但请大家不要介意 这个 find_python default python = /usr/bin/python 让我很不解
因为我在 sublimelinter 的配置文件里面都已经设置了 @python3: "3.6"
具体内容如下
SublimeLinter: find_posix_python: python3 => /usr/local/python3.6/bin/python3
SublimeLinter: find_python: system python = /usr/local/python3.6/bin/python3
SublimeLinter: find_python: available version = {'minor': 6, 'major': 3}
SublimeLinter: find_python: <= ('/usr/local/python3.6/bin/python3', None, 3, 6)
SublimeLinter: sys.path for /usr/local/python3.6/bin/python3:
/usr/local/python3.6/lib/python36.zip
/usr/local/python3.6/lib/python3.6
/usr/local/python3.6/lib/python3.6/lib-dynload
/usr/local/python3.6/lib/python3.6/site-packages
SublimeLinter: pyflakes imported <module 'pyflakes.api' from '/usr/local/python3.6/lib/python3.6/site-packages/pyflakes/api.py'>
SublimeLinter: pep8 imported <module 'pep8' from '/usr/local/python3.6/lib/python3.6/site-packages/pep8.py'>
SublimeLinter: pyflakes version: 1.6.0
SublimeLinter: pyflakes: (>= 0.7.3) satisfied by 1.6.0
SublimeLinter: pyflakes activated: <builtin>
SublimeLinter: pep8 version: 1.7.0
SublimeLinter: pep8: (>= 1.4.6) satisfied by 1.7.0
SublimeLinter: pep8 activated: <builtin>
SublimeLinter: mypy version query: /usr/local/python3.6/bin/mypy --version
SublimeLinter: mypy version: 0.540
SublimeLinter: mypy: (>= 0.520) satisfied by 0.540
SublimeLinter: mypy activated: /usr/local/python3.6/bin/mypy (disabled in settings)
SublimeLinter: find_python(version=None, script='flake8', module=None)
SublimeLinter: find_python: default python = /usr/bin/python
SublimeLinter: find_python: available version = {'minor': 7, 'major': 2}
SublimeLinter: find_python: 'flake8' path = /usr/local/bin/flake8
SublimeLinter: find_python: <= ('/usr/bin/python', '/usr/local/bin/flake8', 2, 7)
SublimeLinter: flake8 version query: /usr/bin/python /usr/local/bin/flake8 --version
SublimeLinter: WARNING: no flake8 version could be extracted from:
Traceback (most recent call last):
File "/usr/local/bin/flake8", line 7, in <module>
from flake8.main.cli import main
ImportError: No module named flake8.main.cli
希望对这个有研究的 V 友能帮忙看一下 感激不尽
1
nightstart OP 顶自己一下
|
2
smallzhan 2017-10-27 13:09:05 +08:00 1
@nightstart 检查下 flake8 脚本的第一行。估计指向了错误的 python 版本。
|
3
nightstart OP @smallzhan 我找到问题了 python 指向是正确的 sublimelinter 设置也是正确的 亏在了缓存文件上。 我把缓存文件删了就正常了
|