What are Virtual Environments in Python? - Python Tutorial

Поделиться
HTML-код
  • Опубликовано: 14 ноя 2024

Комментарии • 52

  • @Gydvbgds6564
    @Gydvbgds6564 3 года назад +2

    I have been searching for years for someone to explain this in the straightforward manner that you just did. I've quit using Python because of how much virtual environments annoyed me, but I need to get back into Django and you my friend are a life saver.

    • @dcode-software
      @dcode-software  3 года назад +1

      You're welcome that's great to hear

    • @Gydvbgds6564
      @Gydvbgds6564 3 года назад

      @@dcode-software I just watched it again it was so good!

    • @Gydvbgds6564
      @Gydvbgds6564 3 года назад

      I had to do an experiment on something that was still bothering me: I had expected that when you change into an environment that you would no longer be in that environment when you left that directory, but following your example and naming the venvs venv_a and venv_b showed me that whatever environment you are in stays that way no matter your directory!
      I think I understand why it's common to always name the environment "venv", but without seeing it laid out I had no way of knowing...until now that is.

  • @enkelly7496
    @enkelly7496 2 года назад +1

    I am working on developing a Kivy Python project for the first time, and this tutorial saved my life. Reading 2D blog posts was not cutting it. Keep up the epic work!!!!

  • @harishkodarapu2224
    @harishkodarapu2224 4 года назад +1

    Thank you for the wondeful video. The last step,
    'pip install -r requirements.txt' was superb, for the fact that it extracts all the required frameworks in a single command

  • @nialperry9563
    @nialperry9563 3 года назад

    The requirements.txt explanation is not what I wanted, but exactly what I needed. Thumbs up.

  • @experimentoruser9917
    @experimentoruser9917 3 года назад

    Best Explanation of virtual environment (2)

  • @naughtrussel5787
    @naughtrussel5787 5 лет назад +6

    Finally some good explanation on this topic. Thank you a lot.

    • @akeemlouigarde4946
      @akeemlouigarde4946 3 года назад

      I know right. The only thing I am confused about is how do you extract it from the virtual environment without using another virtual environment. I tried using the command @13:47 outside the virtual environment to be install in python's site packages and it did not work. I understand what he's talking about, but if I can only use the virtual environment in the command prompt what's the point of using it if I wanted to create a new file ??

    • @naughtrussel5787
      @naughtrussel5787 3 года назад

      @@akeemlouigarde4946 The installation from requirements.txt should work inside and outside of virtual environment. It's just regular installation, but the packages are placed globally. If you wanna test a simple script which does not use any specific dependencies, then there's no need to create a virtual environment, that's fine.

  • @Skalexsong
    @Skalexsong 4 года назад

    This is simply understandable for human(newbie) programmer.

  • @prathimanju14780
    @prathimanju14780 Год назад

    indeed best explanation of virtual environments,greak work

  • @michaelmcmanus2186
    @michaelmcmanus2186 4 года назад

    Best explanation of virtual environments I've seen thus far. Great work! Thank you!

  • @shreyasgosavi9647
    @shreyasgosavi9647 2 года назад

    That was a very good explanation... thanks man !!

  • @story_teller_1987
    @story_teller_1987 3 года назад

    Very nice and clear explanation...Good work..Keep it up

  • @Pyraptor
    @Pyraptor 5 лет назад +1

    You are uploading videos just as I need them lol

  • @hundredvisionsguy
    @hundredvisionsguy 4 года назад +1

    Thanks so much. It's just what I was looking for.

  • @rafapioli75
    @rafapioli75 3 года назад +1

    Thanks for the content! One question, does the requirement.txt updates automatically if I pip install a new library?

  • @markusaurelius1190
    @markusaurelius1190 3 года назад

    Hi mate. Very well explained. Excellent video. Thank you!

  • @SinanZen1981
    @SinanZen1981 3 года назад

    Fantastic video thanks

  • @rryann088
    @rryann088 4 года назад

    helped understand big time!!!

  • @niek1899
    @niek1899 3 года назад

    Very usefull video!

  • @dmcp3261
    @dmcp3261 3 года назад

    What keyboard did you use when recording this vid? Keys sound good.

    • @dcode-software
      @dcode-software  3 года назад

      CoolerMaster MasterKeys Pro S RGB Cherry MX blue

  • @semih2211
    @semih2211 3 года назад

    I'm having an error while installing specific version of requests. However there is no problem to go with "pip install requests"
    (env) C:\Users\semih\Desktop\semih-deneme\p1>pip install requests

  • @ikehakinyemi
    @ikehakinyemi 4 года назад

    Thanks alot. Finally grasp the concept. What color theme is that on your vscode? Love it.

    • @dcode-software
      @dcode-software  4 года назад

      No worries. It's been a while but from memory theme used was Ayu:
      marketplace.visualstudio.com/items?itemName=teabyii.ayu

  • @natetolbert3671
    @natetolbert3671 3 года назад

    You can run batch files from any terminal on windows. Probably need administrator privileges though.

  • @story-house-viral
    @story-house-viral 2 года назад

    Hi, I do the same thing, but when I type “ import requests”, it gives error and says no module named requests. What can I do?

  • @renemiche735
    @renemiche735 4 года назад

    thank you for this clear video! I now use venv inside of pycharm. Do you know if venv can work with libraries as tensorflow? I can not install it inside a new venv for the while.
    thanks for your work!

  • @cach_dies
    @cach_dies 3 года назад

    Wait, so thus means that I should create a venv for every project I do? Do I have to the manually pip install all the packages I need in each? (By manually I mean using the terminal, even if using requirements method shown in the video)

    • @dcode-software
      @dcode-software  3 года назад

      Yes, you *should* use a venv for every project you do. It's actually quite important, that way your app will work no matter which computer it is on (think about if you switch Python versions or you send your code online/to a friend).
      And yes, you need to manually do "pip install" - I don't think it's too bad, you only do it once (generally) and people always do it when using Node.js

    • @cach_dies
      @cach_dies 3 года назад

      @@dcode-software thanks! Doesn't this take up a lot of space though?

  • @indrajeetyadav3369
    @indrajeetyadav3369 3 года назад

    Thanks sir

  • @akeemlouigarde4946
    @akeemlouigarde4946 3 года назад

    How do I use virtual environment in a new file? in python's IDLE (not using command prompt)

    • @naughtrussel5787
      @naughtrussel5787 3 года назад

      you create venv, activate it and launch idle. It will be launched in venv.

    • @akeemlouigarde4946
      @akeemlouigarde4946 3 года назад

      @@naughtrussel5787 I am not talking about python's IDLE in command prompt I am talking about python's IDLE without it. What you said is what the video explained. But without the command prompt it doesn't work. I don't see the point of using a virtual environment if it only works like that.

    • @naughtrussel5787
      @naughtrussel5787 3 года назад

      @@akeemlouigarde4946 I feel you have confused some of the terminology.

    • @akeemlouigarde4946
      @akeemlouigarde4946 3 года назад

      @@naughtrussel5787 There's IDLE and there's our command prompt that can open python, I'm talking about not opening python with command prompt.

    • @naughtrussel5787
      @naughtrussel5787 3 года назад

      @@akeemlouigarde4946 That GUI IDLE application runs fine from a virtual env : activate the environment and python -m idlelib.idle , and the window will appear.

  • @sangtengkorak1954
    @sangtengkorak1954 3 года назад

    Thanks friend, or if you prefer, mate

  • @Alpacastan21m
    @Alpacastan21m 4 года назад

    Can this logic be used for Jupyter notebooks as well?

    • @naughtrussel5787
      @naughtrussel5787 3 года назад

      Yes, it works with jupyter notebooks as well. You create a venv and activate it, then install ipykernel, launch a command from its docs to create a new kernel. The new kernel will point to your virtual enviromnet and you will be able to switch environments in kernel menu.

    • @Alpacastan21m
      @Alpacastan21m 3 года назад

      @@naughtrussel5787 thank you. Wish I got this response a year ago.

  • @themanofthehour1418
    @themanofthehour1418 5 лет назад +1

    Hell yeah

  • @msiddiquek6197
    @msiddiquek6197 5 лет назад

    Sir please create faucet Rotator in HTML and JavaScript

  • @KostaTsourdalakis
    @KostaTsourdalakis 5 лет назад

    🔥 🔥 🔥