Search code examples
pythonvisual-studio-codepython-importpytubepylance

Import "pytube" could not be resolved pylance (repotMissingImport)


from pytube import Youtube

enter image description here


Solution

  • Based on the information you provided, I reproduced this problem:

    enter image description here

    Please refer to the following to check the installation process of the module:

    1. If you have multiple python environments, please check whether the VS Code terminal is using the selected python environment (shown in the lower left corner of VS Code), if they are not the same, please open a new VS Code terminal. (python --version)

      enter image description here

    2. Install the module "pytube". (pip install pytube)

    3. Check the location of the module: (pip show pytube)

      enter image description here

    4. Then, please reload VS Code to make it recognize this module:(F1, Developer: Reload Window)

      enter image description here

    Reference: Python environment in VS Code.