Python Virtual Environments - Full Tutorial for Beginners

  Рет қаралды 44,317

Tech With Tim

Tech With Tim

Күн бұрын

In this video, I will show you step by step how to create a virtual environment in Python. A virtual environment is a self-contained location that enables you to maintain separate and isolated environments for your python projects. This isolation allows you to manage dependencies, versions, and packages without conflicts across different projects.
If you want to land a developer job: techwithtim.net/dev
Skool community for free resources: www.skool.com/software-develo...
Discord server: / discord
⏳ Timestamps ⏳
00:00 | What Are Virtual Environments?
00:47 | Creating a Virtual Environment
03:17 | Installing Packages
04:29 | Saving Dependencies
05:25 | Example Work Flow
07:07 | Virtual Environment Tips
Hashtags
#TechWithTim
#PythonVirtualEnvironments
#PythonProgramming
#CodingTips

Пікірлер: 58
@TechWithTim
@TechWithTim 2 ай бұрын
If you want to land a software developer role check out my program with CourseCareers: techwithtim.net/dev
@pietrovalentinoyannellihan3883
@pietrovalentinoyannellihan3883 2 ай бұрын
Hello, i followed your instructions In the video to deploy a flask app in Ubuntu but It didnt work, It shows me the 403 forbidden error, im using plesk, does that Matter?
@pietrovalentinoyannellihan3883
@pietrovalentinoyannellihan3883 2 ай бұрын
I already located the correct files with cd
@agentm10
@agentm10 2 ай бұрын
One small comment, venv folders are usually named .venv so that they are hidden, and they also should be part of your git ignore if you put them in the same folder as your .py files. I usually have the .venv folder a level up from the .git directory, so that there is no issue with commits if you forget to put them in .gitignore. Fantastic video as usual!
@Helli__
@Helli__ 2 ай бұрын
Great video! As a Python beginner myself, I think virtual environments should be the first thing to learn after the basics. Even if you're just messing around with some package you're trying out, it makes it so much easier to keep your projects organized. It also helps with learning further packages etc.. Want to learn Flask? Just make a new environment for it, keeping everything together and contained, without cluttering your Python installation(s).
@brianhotton2262
@brianhotton2262 2 ай бұрын
Thanks for the great video. I was just learning about virtual environments via some python training I’m taking at work. We are slowly trying to migrate from being a SAS programming shop to using python to code. After watching your video, I learned some additional details that weren’t covered in that training. Got to add some of what you said into my class note. Appreciate the content you’re making. I’ve seen a few of your other videos and they’re always very clear and informative. Keep up the great work.
@casperolsen8147
@casperolsen8147 2 ай бұрын
Your delivery on Python topics are the best on KZfaq.
@JohnS-er7jh
@JohnS-er7jh 2 күн бұрын
Another awesome video. Corey Schafer 's channel and Tech With Tim are my two favorite Python channels, and of course you can learn a lot more then just python. Thanks for posting more great content.
@Gndt1
@Gndt1 Ай бұрын
Excellent video. Clear, concise and informative.
@Oodle-ox2vf
@Oodle-ox2vf 2 ай бұрын
Good video, not too slow, stayed on topic, works for me. 🙂
@Al_Miqdad_
@Al_Miqdad_ 2 ай бұрын
thanks that was very helpful I was diving in this in the last days 😂 do more videos May Allah guide you to his path ❤
@alexis_suarez
@alexis_suarez 2 ай бұрын
This is exactly what I was looking for, really useful
@mathiaselorm5996
@mathiaselorm5996 2 ай бұрын
As beginner, after learning python basics, virtual environment is the next thing to learn. It will help you when start learning Django or Flask frameworks. Great video 👍👍👍
@tokenizedgameplay
@tokenizedgameplay Ай бұрын
Thanks Tim, you made it look easy
@dezly-macauley
@dezly-macauley 2 ай бұрын
Great video TIm! I honestly think this is the first thing that beginners should learn before even writing their first "Hello world". Knowing the best practice of how to correctly setup a project in programming language will reduce future headaches, and allow one to focus on writing code.
@jonasvilks2506
@jonasvilks2506 2 ай бұрын
Hi. Thanks a lot! How to use multiple versions of python on one machine? For some projects I need python 3.10 and for some 3.12. Do you recommend to use conda for this scenario or just install several version in OS and use python venv?
@MiroKrotky
@MiroKrotky 2 ай бұрын
Thank you i had a slight mish-mash in my head about this from multiple tutorials
@chinzorigyou
@chinzorigyou Ай бұрын
Thanks bro. I wonder why this kind of Python related tutorials rare?
@anutarobert3022
@anutarobert3022 Ай бұрын
TIM you are GOOOD!
@markgruic8495
@markgruic8495 2 ай бұрын
Great job
@hiasvonminga4948
@hiasvonminga4948 2 ай бұрын
Hi Tim, again a very tutorial, thank you! I am really with you - anybody who can benefit from this tutorial probably should stick with venv because it is just there. It would be interesting for me, how the different tools relate and differ. I know that anaconda is oriented towards data science… but what does that actually mean? Anything I can do in anaconda I can’t do with venv? Another question: how do vscode and venv interact? A tutorial how to use environments in vscode and how to use the environment once programming is done. Also, how to handle the environment when I want to pull a project from git? Do I have to use the same tool the maintainer used to recreate the project‘s environment or can I still rely on venv? Thanks for your work, it is a very nice display for your paid course!
@Boghost1430
@Boghost1430 2 ай бұрын
Hello Tim, I've started to use Zed however virtual environments are not as easy to use as in vscode and even after looking through zed's docs i wasn't able to solve the issue, do you have any advice pls
@JohnColgan.
@JohnColgan. 2 ай бұрын
Back in CPM days, PIP was acronym for Peripheral Interchange Program. Used for copting files to another drive or device
@311DaveR
@311DaveR 2 ай бұрын
Yep - I used a Z80 processor board on my Apple 2. It brings back memories as well. :)
@cadetaylor429
@cadetaylor429 Ай бұрын
Quick question - after creating a virtual environment, will my 'import' statements in my code automatically import the versions of the package that are installed in my virtual environment? Because I have some packages installed globally and in the virtual environment - I'm curious which version will get precedent. Also, is it entirely bad practice to install any packages globally? Should I uninstall all globally installed packages and only use virtual environments? Thanks!
@KumR
@KumR 2 ай бұрын
I always had one question Tim. Hope you can clarify. Lets say I create two virtual environments A and B. I do a pip on both and install libraries like Numpy, Pandas, TF, sklearn on both A and B, will that not occupy disk space? Does that mean for every project we do locally, the disk space gets consumed not just for code but these duplicate libraries too ? Is there an option to share a library between two virtual environments (if same version is needed) ? Please clarify
@beotiger
@beotiger 2 ай бұрын
Yes, every project you create in venv occupies its own disk space. And no, there is no such option to share same libraries between venvs for it makes no sense. You create venv to be isolated from other venvs so you should not and must not share any libraries berween them.
@user-ts9ks8in2n
@user-ts9ks8in2n 2 ай бұрын
Holy Tim!, thanks for that. Is venv the standard or the conda environment?
@TechWithTim
@TechWithTim 2 ай бұрын
vent is more common
@spacecoder0526
@spacecoder0526 2 ай бұрын
Can you make tutorial of deploying fast api or any python api projects including virtual environment with docker?
@hasanx8317
@hasanx8317 21 күн бұрын
We also need to ignore the venv directory in the git repo right?
@yadhumanikandan7220
@yadhumanikandan7220 2 ай бұрын
Can you do docker tutorial too.
@chriskeo392
@chriskeo392 2 ай бұрын
I need that docker compose tutorial asap😅
@yadhumanikandan7220
@yadhumanikandan7220 2 ай бұрын
yeaahhhh!!! 😆@@chriskeo392
@sw-code6027
@sw-code6027 2 ай бұрын
​@@chriskeo392 did you found any good tutorial?
@johnidouglasmarangon
@johnidouglasmarangon 2 ай бұрын
Nowadays it is difficult to work without virtual environments especially if you work on more than one Project at the same time. I like using pyenv because I can easily install new versions of Python and create or remove envs . pyenv has an interesting set of CLI commands.
@gamingguy577
@gamingguy577 2 ай бұрын
Can Davin do backened ?
@spicyshizz2850
@spicyshizz2850 2 ай бұрын
Do you plan to make ML & AI videos soon?
@AmodeusR
@AmodeusR Ай бұрын
For me, using windows with bash, I need to run source env/Scripts/Activate to activate the virtual env.
@pauloclara4764
@pauloclara4764 2 ай бұрын
Whats diference to docker
@bostonmike6912
@bostonmike6912 Ай бұрын
Make a video on poetry package management for python.
@saurabhparthe1219
@saurabhparthe1219 2 ай бұрын
sir your videos are very nice can you make a project on iron man jarvis.
@abdulmobinkarimi6846
@abdulmobinkarimi6846 2 ай бұрын
make a video about DEVIN
@BillAugersdca
@BillAugersdca 2 ай бұрын
When you show the four common choices for virtual environments at 1:31, you seem to equate virtualenv with venv as the images display on screen. Beginners should understand that virtualenv is a third-party tool.
@kacper2028
@kacper2028 29 күн бұрын
Wait so what actually is in the venv folder?
@pietrovalentinoyannellihan3883
@pietrovalentinoyannellihan3883 2 ай бұрын
hello, i followed your instructions in your video to deploy a flask app in ubuntu, but it shows me the error 403 forbidden, so i need to know, your tutorial doesnt work if you are using plesk?, i already located the files with cd and made the arrengements with the wsgi file
@pietrovalentinoyannellihan3883
@pietrovalentinoyannellihan3883 2 ай бұрын
Im sorry for putting the comment here but i think IS more likely to receive help if the comment IS in a recent video
@sandilemasuku2240
@sandilemasuku2240 2 ай бұрын
I believe your are able to get a job at c.i.a or m.k 7 agency.
@Mustang_G
@Mustang_G 2 ай бұрын
I always thought you just opened VS code and open new file.
@crystyxn
@crystyxn 2 ай бұрын
I thought -r stands for recursive
@agentm10
@agentm10 2 ай бұрын
clearly not. Tim is very explicitly saying that -r is for "install fRom a file", lol.
@crystyxn
@crystyxn 2 ай бұрын
@@agentm10 yeah, thats why I commented that. Turns out the -r actually comes from "requirements".
@agentm10
@agentm10 2 ай бұрын
@@crystyxn yup, -r FILENAME is the same as --requirement=FILENAME. Although recursive also makes sense as you have to go through all the entries in the file.
@jabirmustafasulaiman5147
@jabirmustafasulaiman5147 2 ай бұрын
Is your course free
@TechWithTim
@TechWithTim 2 ай бұрын
There is a free introductory course that is about 1.5 hours long that you can watch before deciding on the full program
@vetriselvan9807
@vetriselvan9807 2 ай бұрын
Nothing free in this world
@akramazad5137
@akramazad5137 2 ай бұрын
Davin can do this in few minutes
@gmailservice9945
@gmailservice9945 2 ай бұрын
excellent tutorial thank you
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 79 МЛН
He tried to save his parking spot, instant karma
00:28
Zach King
Рет қаралды 20 МЛН
Cat story: from hate to love! 😻 #cat #cute #kitten
00:40
Stocat
Рет қаралды 16 МЛН
🍕Пиццерия FNAF в реальной жизни #shorts
00:41
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 79 МЛН