Python venv simply explained for BOTH Windows and Linux

preview_player
Показать описание
#Python #Venv #VirtualEnvironments
How to use virtual environments in Python, and also how to ignore them on Github, using .gitignore.
In this video, we will be looking at virtualenv and why you should be using virtual environments in Python. Virtual environments are a huge benefit for each project you will work with. Also if you maintain your projects in Github, then you should also watch this and use .gitignore to not save your venvs in the repository.

Connect with me with:

🔥 Comment below if you want to see more videos in that style

👍 Subscribe to start your Python Developer / DevOps Engineer journey here:

🎥 My YouTube Gear 🎥

Links:

My Personal website for code snippets:

Timeline of the video:
00:00 - 03:16 - What problems venv solves?
03:17 - 07:08 - Creating virtual envs and activate them
07:09 - 07:39 - Deactivate virtual envs
07:40 - 12:07 - Benefits of pip freeze
12:08 - 18:38 - How to avoid maintaining venv dir on Github?
Рекомендации по теме
Комментарии
Автор

It will be my mistake saying that venv (in current state) reaches 300MB, as I pointed out to the space that is left on my disk ... (Which is 300GB anyway, my calculation was wrong there)
Originally, the size on the disk of a venv (empty from additional libraries installed) would be around 20MB. As we keep installing libraries, it will get larger.
Thanks a lot to​ @Doug Sigman for mentioning this out.

Will you use virtual environments from now on?

jimshapedcoding
Автор

Oh my god, I was going crazy with my code, so happy I found this!! Thank you :)

PortgueseProBF
Автор

Pretty well explained! Thank you so much.

patriciodiaz
Автор

Yeah it is so important. Now I know about the virtual environment because of you. Thank you sir ❤️

gayashan
Автор

Thanks for another great video. I always learn something in your videos.

michaelvail
Автор

Nice video as always! Do you've any plans on recording videos teaching about Network Programming in Python?

Ловимомент-бп
Автор

I have a quick question im trying to run a program with the virtual environment but i think one library called tabula is trying to seach java in my
"machine:"C:\Users\padiaz\Desktop\Actualizaciones\venv\Lib\site-packages\jpype\_jvmfinder.py", line 212, in get_jvm_path
raise JVMNotFoundException("No JVM shared library file ({0}) "
No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly."
This is the error im getting, how can i get java into the virtual environment?
Thanks a lot.

patriciodiaz
Автор

Good video Jim. How many years you are using Python? I would like to know where the 2 environment variables are stored, could not find them... Thx

SA-ojbo
Автор

Can someone help me i am trying to ignore the venv but it is not ignoring

tanishagrawal
Автор

What is the reason you create the venv yourself in Pycharm? Pycharm automatically creates one for every new project no?

SA-ojbo
Автор

So we shouldn't put the venv directory on github. However, in this directory there is a file requeirments.txt - how then a person who wants to run this program will know what modules he needs to install?

TheVojak