Python Tutorial: VENV (Mac & Linux) - How to Use Virtual Environments with the Built-In venv Module

preview_player
Показать описание
In this Python Programming Tutorial, we will be learning how to use virtual environments on the Mac and Linux operating systems with the built-in venv module. We will learn how to create them, activate them, remove them, and much more. Let's get started...

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Python #venv
Рекомендации по теме
Комментарии
Автор

You've gotta show this guy the love as he always explains things in such simple terms and then gives you a little extra that you weren't expecting! Thank you sir for all the time you invest to give us great content!

Rocorama
Автор

0:48 why virtual environment
to have a space where we can install packages specific to a certain project
0:57 example for updating from Django 1 to Django 2
1:22 each project should have its own packages separate from each other
1:34 demo: need *Python 3.3 or higher*
2:05 pip3 list
2:51 create a new virtual environment - 2:57 *python3 -m venv project_env* (project_env is the name of the project to be initialized)
3:42 activate the created virtual environment - 3:45 *source* project_env/bin/activate
5:34 if other wants to export the packages that are used 5:39 *requirement.txt*
5:56 *pip freeze*
6:25 in Linux: *pip freeze > requirements.txt*
6:55 deactivate the project
*7:43** normal practice of using venv*
8:24 use of the created requirements.txt
8:35 *pip install -r requirements.txt*
9:04 one thing to mention: *it is common to put virtual environment inside your project folder, but you don't want to put project files into your virtual environment*
9:29
10:01 you shouldn't commit your virtual environment to your source control
10:16 what should be committed in version control: your requirements.txt
10:38 how to create an environment with access to system-packages
11:29 --system-site-packages
12:08 the additional packages installed in this environment won't affect the system packages
12:35 pip list --local

ruixue
Автор

You are just too great. Nowadays I search YouTube with your name I be like "virtual environment in Python Corey Schafer" .

kipronoelijahkoech
Автор

Simple, direct and well explained.

Thanks man, this helped me!

rafaelalvesduarte
Автор

I was so much confused about the environment thing earlier but after watching the video you made so easy for me to understand. You're great!

abraraltaflone
Автор

These virtual environments are a really clever way to not run into problems when you have different projects with different requirements. I love it!

Ben-kzkm
Автор

I love how simple and straightforward this video is. Whenever I want to learn something new about Python, I first check to see if you've covered it.

joelprestonsmith
Автор

concise, clear and perfectly delivered. I will be using this a lot from now on.

leedavies
Автор

been to numerous pages, wikis, stackoverflows and only got confused snippets of virtual environments. Watched your video and my brain got opened and clarity shone inside... magnifico!

pavelow
Автор

The introduction to venv that I was seeking - concise yet complete.

xA
Автор

You're a great teacher. All of your video's are clear and interesting. Especially for an advanced noob like me.

rudiklein
Автор

So simple, yet elegant and concise explanation of something I just now comprehended completely. Congrats Corey, you are a phenomenal teacher!

alexandrostsagkaropoulos
Автор

This video explains everything...and then goes beyond! Loved it.

sheesh_kebab
Автор

Corey...thank you...I have just started the road to data science and one thing I have never had a good simple explain action if were basics of setting up environments without much hassle. I followed this like ABC. I understand what is happening, what to do, how to undo it and how to pass it on.

loudencm
Автор

Thank you for such an amazing video, You seem to know exactly what your student has in mind and what problems he is trying to solve while watching your videos.

souravkaranjai
Автор

Simple and straight to the point. Thank you for this. Much appreciated.

AdeAderinto
Автор

thank you for clearling up, not only how it's done, but also how the convention is

ichbrauchmehrkaffee
Автор

On all of your videos (that I've watched) you fill knowledge gaps perfectly.

Ausare
Автор

Thanks for the helpful explanation Corey.


For those folks (like me) using the fish shell, at around the 3:50 mark you'll need to enter *source py3env/bin/**activate.fish* in the terminal otherwise you'll most likely get an error like this:


project_env/bin/activate (line 74): Missing end to balance this if statement
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
^
from sourcing file project_env/bin/activate
called on standard input


source: Error while reading file 'project_env/bin/activate'

nicklansbury
Автор

As someone coming to Python from another programming language, this was very helpful!

KolHaNDLuKex