Search code examples
pythonvisual-studio-codegmail-api

how can I fix httplib2, oauth2client and apiclient libraries not importing in vscode python?


this is my import codes, and I pip install all the files I should:

from apiclient import errors, discovery
import oauth2client
from oauth2client import client, tools, file
import httplib2

And this is the error for all of them:

Import "httplib2" could not be resolved from sourcePylancereportMissingModuleSource
Import "oauth2client" could not be resolvedPylancereportMissingImports
Import "apiclient" could not be resolvedPylancereportMissingImports

I use windows system. Please help me fix these problems.


Solution

  • First make sure you have installed all the packages in the code using pip command. You can check package installation information with pip show package_name.

    package installation information

    Then follow these steps:

    1. Open the command palette with Ctrl+Shift+P ( Or click the python version in the lower right corner of the interface ).

      enter image description here

    2. Type and select Python:Select Interpreter.

      enter image description here

    3. Choose the correct interpreter.

      enter image description here

    This will solve your problem.