How do I get PyLint to recognize numpy members?

前端 未结 22 1031
南旧
南旧 2020-11-28 20:29

I am running PyLint on a Python project. PyLint makes many complaints about being unable to find numpy members. How can I avoid this while avoiding skipping membership check

22条回答
  •  时光取名叫无心
    2020-11-28 20:45

    A little bit of copy paste from the previous answer to summarize what is working (at least for me: debian-jessie)

    1. In some older version of pylint there was a problem preventing it working with numpy (and other similar packages).

    2. Now that problem has been solved but external C packages (python interfaces to C code -like numpy-) are disabled by default for security reasons.

    3. You can create a white list, to allow pylint to use them in the file ~/.pylintrc.

    Basic command to run: # ONLY if you do not already have a .pylintrc file in your home $ pylint --generate-rcfile > .pylintrc

    Then open the file and add the packages you want after extension-pkg-whitelist= separated by comma. You can have the same behavior using the option --extension-pkg-whitelist=numpy from the command line.

    If you ignore some packages in the [TYPECHECK] section that means that pylint will never show error related to that packages. In practice, pylint will not tell you anything about those packages.

提交回复
热议问题