
Opencv – you have to type ‘pip install OpenCV-python’. Not every time, in Python for the installation, the module name will be the same as the name we used to import. This is how we can install the library in VS code in two ways. Now open the terminal again by either clicking on New Terminal or pressing Ctrl+Shift+`Īnd now you can see you are in a virtual environment.Īnd now, here, type in the commands to install the library.Īnd hurray, the library is installed. python -m venv folder-path\venvĭon’t forget to add the \venv after the folder your specified. Note that, this should be the same folder where your. the path where you want to create a virtual environment. The shortcut is to type in Ctrl+Shift+`.Ĭopy the folder path i.e. It is actually installed only for that environment, only for that directory where you are creating the virtual environment. py file from any other directory, you will see that the library isn’t installed. If you are trying to run the same code from any other. In a very sober way, you actually are installing the libraries within those folders and within the environment. What is the virtual environment?Īccording to docs, a virtual environment is a Python environment such that the Python interpreter, libraries, and scripts installed into it are isolated from those installed in other virtual environments, and (by default) any libraries installed in a “system” Python, i.e., one which is installed as part of your operating system. Here the libraries you are installing will not be installed actually in your main system. This is one of the best and most practiced ways.

The libraries are getting installed here globally, which means inside your system, you can run the code by importing it from any directory.

This means every time you want to install a specific library, just open the terminal, type in the command terminal, and hit Enter.
