Search code examples
pythonvisual-studio-codepip

I am using Python on Visual Studio Code to import an excel file but I am getting an import error


I want to read the data on an excel file within a F drive. I am using python on Visual Studio Code to try achieve this however I am getting an error as seen in the pictures below. I installed pandas but I still get an error. How can I fix this issue?

Coding Error

Installed Pandas Library

I tried closing and opening visual studio. I tried uninstalling and reinstalling pandas.

Python on Computer


Solution

  • You should try to open terminal in VS Code, and run pip freeze (and pip3 freeze). Check if you find pandas in the results, it won't. That must be because you'd have multiple installations of Python on your system. You may do any one of the below -

    1. Get rid of all but one Python installation.
    2. Install pandas on the VS Code installed python instance.
    3. Configure the same installation of python that is referenced by your command prompt. (choose the correct python interpreter from VS Code Command Palette)