我将flake8配置为syntastic插件中的python检查器。问题是我的项目在运行时向sys.path添加了一些额外的路径。我需要一些地方来配置这些路径,否则检查程序会一直抱怨[F0401] Unable to import 'module'。我在哪能做到这点。
更新
结果发现,抱怨导入错误的是pylint检查器。flake8似乎并不关心这个问题。以下是flake8的输出。为pylint解决这个问题的方法是:PyLint "Unable to import" error - how to set PYTHONPATH?。
$ flake8 TestListPage.py
TestListPage.py:7:1: W191 indentation contains tabs
TestListPage.py:8:1: W191 indentation contains tabs
TestListPage.py:9:1: W191 indentation contains tabs
TestListPage.py:10:1: W191 indentation contains tabs
TestListPage.py:12:1: W191 indentation contains tabs
TestListPage.py:13:1: W191 indentation contains tabs
TestListPage.py:15:1: W191 indentation contains tabs
TestListPage.py:16:1: W191 indentation contains tabs
TestListPage.py:18:1: W191 indentation contains tabs此外,@ Also 047的回答可能有助于使用python解释器的其他插件。但是它没有修复pylint错误。
$ echo $PYTHONPATH
/cygdrive/c/---------------/
$ pylint TestListPage.py
************* Module TestListPage
W: 7,0: Found indentation with tabs instead of spaces
...
C: 45,0: Line too long (95/80)
...
C: 1,0: Missing docstring
F: 3,0: Unable to import 'guis'发布于 2015-06-04 05:57:45
在运行vim之前设置环境变量PYTHONPATH:
PYTHONPATH='/some/dir:/some/other/dir' vim /path/to/your/file.py或来自Vim本身:
let $PYTHONPATH='/some/dir:/some/other/dir'https://stackoverflow.com/questions/30635523
复制相似问题