skip to Main Content

I am trying to use VS Code and I am importing some modules (for example : pandas and streamlit). The terminal of VS Code tells me "No module named pandas" or "No module named streamlit" whereas it is downloaded on my computer.

VS Code:

enter image description here

Terminal of my computer when trying "pip install streamlit":

enter image description here

Do you know how I could correct this mistake ?

2

Answers


  1. You are in a different env, so before you can import, you will have to append the path of the installed packages to your working environment.

    import sys
    sys.path.append("/opt/anaconda3/lib/python3.9/site-packages")
    
    import streamlit as st
    
    Login or Signup to reply.
  2. Please ensure that the environment is consistent. pip installs the library into the real Python environment, and you use the virtual environment.

    1. If you want to use it in the virtual environment, please use the
      command conda install to install it.
    2. If you want to use the real python environment, you can use shortcuts "Ctrl+shift+P" and type "Python: Select Interpreter" to change the python environment.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search