Python Tutorial: VENV (Mac & Linux) - How to Use Virtual Environments with the Built-In venv Module
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...
VENV (Windows) - • Python Tutorial: VENV ...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Python #venv
Пікірлер: 236
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!
@coreyms
5 жыл бұрын
Thanks!
You are just too great. Nowadays I search KZread with your name I be like "virtual environment in Python Corey Schafer" .
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
@lofi_Insomnia_
3 жыл бұрын
this is awesome
@viviantomlinson
3 жыл бұрын
thank you!!
Simple, direct and well explained. Thanks man, this helped me!
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!
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.
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!
These virtual environments are a really clever way to not run into problems when you have different projects with different requirements. I love it!
So simple, yet elegant and concise explanation of something I just now comprehended completely. Congrats Corey, you are a phenomenal teacher!
This video explains everything...and then goes beyond! Loved it.
concise, clear and perfectly delivered. I will be using this a lot from now on.
The introduction to venv that I was seeking - concise yet complete.
You're a great teacher. All of your video's are clear and interesting. Especially for an advanced noob like me.
Simple and straight to the point. Thank you for this. Much appreciated.
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.
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.
thank you for clearling up, not only how it's done, but also how the convention is
Thanks! I finally got my head around venv...
On all of your videos (that I've watched) you fill knowledge gaps perfectly.
Great videos Corey. Clear and perfect explanation.
It's like whatever my problems are, you have a solution or tutorial. Thanks soooo much!
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'
Great tutorial thanks. Short and informative. Below are my notes. 1. Create a seprate folder for venv data inside the project source 2. Create virtual environment -python3 -m venv {path/folder} $ python3 -m venv venv 3. Create virtual environment which have access to system packages $ python3 -m venv venv --system-site-packages 4. Activate virtual environment -source {folder}/bin/activate $ source venv/bin/activate 5. Check if venv is activated $ which python 6. List installed package pip list 7. List packages installed in venv $ pip freeze 8. Export required package to requirment.txt pip freeze > requirment.txt 9. Exit venv deactivate 10. Install packages from requirment.txt in venv $ pip install -r requirement.txt
Very clear explanation and covers only what is needed, Thanks for this crisp and clear video clip!
This was so clear, concise, and comprehensive. Thanks so so much!
This was exactly what I was looking for. THANK YOU! You're a great teacher.
As someone coming to Python from another programming language, this was very helpful!
Excellent video to explain the basics of virtual environments! Thank you!!
Incredible videos. Kept answering my questions as he went. Keep up the good work.
Best video on venv that I found of the six I watched (and didn't even care to finish watching in some cases).
Man! Your channel is awesome Keep up with the awesome work
7:22 Creating a new virtual environment (Best practice) 4:28 If you need to use a different version of python 5:40 Exporting packages from your environment with requirements.txt file 8:25 Creating a virtual environment from a requirements.txt file 10:30 Deactivating environment 11:00 Creating a virtual environment containing all system packages 12:35 Listing packages you've installed within the environment (not system packages)
Dear Sir. Thanks for the great work !!! I was looking for a env tutorial for Mac and this is exactly what I found here !!! Great job. I give like and ... subscribe ! Greetings from Belgium.
Awesome - much simpler than pipenv ... Thank you for posting that video.
Thank you. I learned Python Virtual Environment Quickly
@corey shafer thanks for the great videos and sharing you knowledge with us. its nice to watch an informative video from someone who speaks clearly;y and is professional and to the point. THANK YOU
Great job Corey. I really appreciate the detailed tutorial.
-system-site-packages was a good tip 👍
Exactly what I was looking for. Thank you!
Always appreciate your video Corey, Thanks :)
Your videos are Awesome! Thanks for sharing your knowledge.
Really helped me understand the importance of virtual environment
this is very helpful. thanks very much. i was puzzled from last 4 days OMG. thanks again...
Yo dude this is like the best guide in this topic
Couldn't have been explained better, thanks!
I had to watch this like at least 3 times, probably more. But Corey is still the best. If I am not going to understand it with Corey, then it was not meant to be. But I definitely got a little more each time.
pretty good idea? bro gotta hand it to you. so clarifying illustrations of venv. thank you for another great tut
Super thorough! Thank you
You explained so clearly! Thank you!
Just what I needed! Thanks!
Right on time. I usually do Python work in Lambda/Cloud Functions environments so my understanding of setting up projects on the desktop is lacking. I always struggle with setting up projects and getting virtual environments working when I have to code the traditional way. The MacOS transition to the z shell has made it worse. Luckily Corey is my Python guru, problem solved. This is the number one Python channel on KZread.
Still works - virtual enviroments can be pretty difficult for beginners, thanks for explaining so detailed
Thank you. Very well explained!
Thanks for the video, as always is explained perfectly!
Thanks for this awesome tutorial. cheers!
Amazing video, straight to the point
Such a life-saver video. Thanks a lot man
Super clear explanation!
This guy is the dopest guy and I love his videos.
This video helped me so much, thanks!
Super. What exactly is needed.
Thanks, Corey! Very nicely done!
Very clear explanation! Thanks!
THANK YOU SIR! it really helped me out i was trying for very long time
Super helpful, Thank you!
Thank you so much. Very clear explanation.
Thank you Mr CoreyMS
Wow. Genius instructor.
thanks very much for the simplest explanation !
Honestly, Corey is a life saver!
Thanks man! I love you. You just saved me.
Very helpful. Thanks, man!
As a newbie I'm super frustrated by the whole python setup thing cuz Mac has 2 versions of python. It drove me nuts and I found your video -- THANK YOU
Great explanation skills. Thanks!
Thanks a lot man! That video was amazing!!
Excellent demo. Thanks.
Man alive! This is useful
thanks for the best explanation I ever seen
Thanks, very helpful stuff...
This was super helpful
Brilliant! Thanks!!
You are great thalaiva...😎
So clear. Thank you.
Best tutorial I have seen to date regarding virtual environments, thank you! Unfortunately the wheels keep falling off 😜 Installing libraries I constantly get : "ERROR: Could not build wheels for X" With Linux it's a wormhole of issues and errors... find a solution like virtual environments for one problem, and Linux will open a door to a list of new ones 🤣😂
great explanation! thanks a lot!
Great tutorial!
amazing tutorial thank you!
great video. thanks!!
Love your videos, Mate.
Clarity! Thank you
great as always. thank you!
Great video, thanks!
Perfect... Thank you :)
Great Video!
crystal clear!
Very useful even for people with low knowledge at english) thx 🤙
very helpful!
Thank you sir. 👍
Thank you sir!
Thanks a lot!