Why does it say that module pygame has no init member?

前端 未结 14 1196
予麋鹿
予麋鹿 2020-12-01 13:57

This is the code I have:

import pygame
pygame.init()

I\'m very confused because if I try to run the file, then there seems to be no issue,

14条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 14:27

    I had the same issue with one of my modules. This is what I did to resolve the problem. (I'm using visual studio on windows 10)

    1. Press CTRL+SHIFT+P in visual studio
    2. Choose "Preferences: Open Settings (JSON)"
    3. Add "python.linting.pylintArgs": ["--generate-members"] below one of the lines (put a comma if necessary)
    4. Save the .json file (CTRL+S)

    For me, the code looks like this :

    {
        "breadcrumbs.enabled": false,
        "editor.minimap.enabled": false,
        "python.pythonPath": "C:\\Users\\xxx\\Anaconda3",
        "terminal.integrated.rendererType": "dom",
        "window.menuBarVisibility": "default",
        "workbench.activityBar.visible": false,
        "workbench.statusBar.visible": true,
        "python.linting.pylintArgs": ["--generate-members"], //line to add
        "[json]": {
    
        }
    }
    

    Hope it helps. Credit to @Alamnoor on github

提交回复
热议问题