Resolving Python Module 'numpy' has no 'xxxx' member error message in Visual Studio Code

While writing some Python code in Visual Studio Code that calls some Numpy classes, Pylint error messages appear complaining about non-existing Numpy members, e.g. the log2 method, and red wavy lines underline the offending code, as shown in the screenshot below. 报错内容。
Resolving Python Module 'numpy' has no 'xxxx' member error message in Visual Studio Code
One way to clear this up is to get Pylint to white-list Numpy using Visual Studio Code's Settings.

  1. In Visual Studio Code, select File | Preferences | Settings.

    The settings.json file is displayed in the editor在Settings中搜索找到“settings.json”。
  2. Resolving Python Module 'numpy' has no 'xxxx' member error message in Visual Studio Code
  3. Click the Workspace Settings tab.

    The settings appear in the editor.
    Resolving Python Module 'numpy' has no 'xxxx' member error message in Visual Studio Code
  4. In the editor, type in the following and save the file.

    在json文件中写入{ "python.linting.pylintArgs" : [ "--extension-pkg-whitelist=numpy" ] }

    Resolving Python Module 'numpy' has no 'xxxx' member error message in Visual Studio Code
  5. Close and reopen the folder in Visual Studio Code.

    The missing member messages and the red wavy underlines no longer appear. 报错消失。Resolving Python Module 'numpy' has no 'xxxx' member error message in Visual Studio Code