[Python] VSCode is using wrong version of Pandas

Discussão em 'Python' iniciado por Stack, Janeiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I have latest version (2.2.3) of Pandas installed in the virtual environment of my Python project in VSCode. But my project is using Panda's version 1.3.5 (I've checked it by using print(pd.__version__). Whereas pip show pandas command in VSCode's terminal in the same project shows the correct version 2.2.3.

    Question: How can I force VSCode to use the latest installed version of pandas in my project.

    Remarks:

    • The code runs fine if I run my file in the terminal of VSCode
    • Pandas was installed for the first time in this project -so there were no older versions before. Since the project is using version 1.3.5 of Pandas, my project is failing since some of its functionalities require version 1.4.0 or higher.
    • When I run the following command to update python, as shown below, it shows that I already have Panda's latest version 2.2.3 installed: (venv) PS C:\PyCopilotProject\my-python-project> python -m pip install -U pandas

    Requirement already satisfied: pandas in c:\pycopilotproject\my-python-project\venv\lib\site-packages (2.2.3) Requirement already satisfied: numpy>=1.22.4 in c:\pycopilotproject\my-python-project\venv\lib\site-packages (from pandas) (2.2.2) Requirement already satisfied: python-dateutil>=2.8.2 in c:\pycopilotproject\my-python-project\venv\lib\site-packages (from pandas) (2.9.0.post0) Requirement already satisfied: pytz>=2020.1 in c:\pycopilotproject\my-python-project\venv\lib\site-packages (from pandas) (2024.2) Requirement already satisfied: tzdata>=2022.7 in c:\pycopilotproject\my-python-project\venv\lib\site-packages (from pandas) (2025.1)
    Requirement already satisfied: six>=1.5 in c:\pycopilotproject\my-python-project\venv\lib\site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)
    ​

    Continue reading...

Compartilhe esta Página