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:
Terminal of my computer when trying "pip install streamlit":
Do you know how I could correct this mistake ?
CodePudding user response:
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
CodePudding user response:
Please ensure that the environment is consistent. pip
installs the library into the real Python environment, and you use the virtual environment.
- If you want to use it in the virtual environment, please use the
command
conda install
to install it. - 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.