简体   繁体   中英

How to properly import libraries that I downloaded via pip or conda?

I am trying to use "matplotlib" for a project and when importing it I get: "matplotlib.pyplot not resolved from source", then I tried to import pandas and I got something similar, how can I fix this? I am using WSL, and I am in a virtual environment that I created in conda.

I want to use some libraries but they are not imported, even though I installed them with pip and it appears that they are there, it does not detect them.

Maybe you are not connected to the correct conda env in visual studio code. You could check that by pressing " CTRL SHIFT P" Then press on Select Interpreter and select your created environment.

To check if matplotlib was installed in the correct environment you could try the following:

  1. open anaconda shell
  2. type "conda env list" ( to see all the environment created)
  3. type "conda activate <name_of_your_environment>"
  4. type "conda list" (to see all the packages installed in this environment"
  5. check if matpotlib appears in the outputed list

More: to open anaconda shell type "anaconda prompt" in the search of your os.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM