Python in VS Code: How to Create and Activate a Virtual Environment (Error-Free)

Опубликовано: 17 Июнь 2026
на канале: Leandro Hirt | Academify
616
33

In this video, you will definitively learn what Virtual Environments are in Python and why they are essential for organizing your projects and avoiding version conflicts between libraries.

I'll show you step-by-step how to configure everything using VS Code, how to manage dependencies with requirements.txt, and also how to create environments manually via the terminal (CMD/PowerShell) and in PyCharm. No more compatibility errors in your projects!

What you will see:

The concept of project isolation.
Automatic creation of environments in VS Code.
Essential PIP commands (install, freeze).

How to move your project to another machine without breaking anything.

LIST OF COMMANDS USED IN THE VIDEO:

Check Python version: `python --version`

Create Virtual Environment (Manually via Terminal): `python -m venv .venv`

Activate the Virtual Environment:
Windows (PowerShell/CMD): `.venv\Scripts\activate`

Linux/Mac: `source .venv/bin/activate`

Manage Packages (Libraries):
Check what is installed: `pip freeze`

Install packages: `pip install package_name`
Example from the video: `pip install pytelegrambotapi python-dotenv requests`

Install libraries from the file: `pip install -r requirements.txt`

VIDEO CHAPTERS:
00:00 - Introduction: The problem of mixed dependencies
00:18 - What is a Virtual Environment (Visual Explanation)
00:45 - Checking extensions in VS Code
01:08 - Creating a Virtual Environment in VS Code (Automatic Method)
01:50 - Checking the .venv folder and Scripts
02:52 - Installing libraries (pip install)
04:05 - Creating the requirements.txt file (pip freeze)
04:41 - Simulating a new project (Cloning repository)
05:25 - Installing dependencies via requirements.txt
06:03 - Creating Venv manually via Terminal (CMD/PowerShell)
06:30 - How to activate the environment manually
06:52 - Creating a Virtual Environment in PyCharm
07:29 - Conclusion

#Python #VirtualEnvironment #VSCode #Programming #PythonTutorial #Dev #Backend