1 00:00:02,440 --> 00:00:10,660 What Jill in my mind will create alternate installations of python using the main installation as a 2 00:00:10,660 --> 00:00:11,350 model. 3 00:00:11,560 --> 00:00:18,210 That is the global installation and then after creating the virtual environment we can switch to the 4 00:00:18,210 --> 00:00:24,220 virtual environment and install a neat package that we may want in here. 5 00:00:24,330 --> 00:00:28,680 And these packages will remain with this specific environment. 6 00:00:30,250 --> 00:00:39,310 So as you can see each watch environment has its own side Packages Folder carrying each one specific 7 00:00:39,310 --> 00:00:42,300 version of the package. 8 00:00:42,420 --> 00:00:50,410 Five in order to use a watch in environment packages or resources in isolation. 9 00:00:50,560 --> 00:00:59,140 We need to activate it and this is the command that we need to type in the command prompt in order to 10 00:00:59,230 --> 00:01:09,590 activate the watch environment so in a newly created virtual environment there will be activate shell 11 00:01:09,590 --> 00:01:17,320 script and these scripts are used to set up our shell to use the environment Python executable. 12 00:01:17,810 --> 00:01:20,580 And it's site packages by default. 13 00:01:21,410 --> 00:01:32,120 So this is a command to activate the the virtual environment source and deep part to the virtual environment 14 00:01:32,780 --> 00:01:36,230 activate scripts in my Windows system. 15 00:01:36,230 --> 00:01:44,720 I have given the pod to the Activate script in the scripts directory in order to activate the virtual 16 00:01:44,720 --> 00:01:45,500 environment. 17 00:01:46,040 --> 00:01:52,070 So let's go ahead and execute and then hit enter. 18 00:01:52,460 --> 00:02:00,860 So after we have activated the watch and Wideman the prompt has now prefixed with the name of our virtual 19 00:02:00,860 --> 00:02:01,630 environment. 20 00:02:01,670 --> 00:02:07,050 As you can see tutorial here is the name of our virtual environment. 21 00:02:07,280 --> 00:02:14,910 And this is the indicator that the watch environment tutorial is currently active and which means the 22 00:02:14,930 --> 00:02:22,160 python executable will only use this environment packages and settings. 23 00:02:22,160 --> 00:02:32,120 So we are in the watch environment tutorial let us install a package in this virtual environment and 24 00:02:32,360 --> 00:02:45,320 the command for installing packages using Pip is p IP install one to install the package your three 25 00:02:45,320 --> 00:02:45,710 key. 26 00:02:45,830 --> 00:02:53,510 So because they were still environment is activator the packages install using Pip are placed in the 27 00:02:53,510 --> 00:02:54,960 watch environment. 28 00:02:55,000 --> 00:03:02,400 Sight packages directory instead of the python's installation side packages directory. 29 00:03:02,780 --> 00:03:09,330 So let's verify the packages installed in the Wachtel and Weidmann side packages directory. 30 00:03:10,040 --> 00:03:19,370 So this is the directory for the watch Alan Weidman and let us go to the folder library and then go 31 00:03:19,370 --> 00:03:28,770 to site packages and here we have the newly installed package in the virtual environment site packages 32 00:03:28,800 --> 00:03:32,540 directory. 33 00:03:32,730 --> 00:03:40,650 Next a virtual environment provides an easier method to keep track of the packages installed in the 34 00:03:40,650 --> 00:03:41,380 project. 35 00:03:42,150 --> 00:03:48,660 So once we have activated the virtual environment it provides defensively to freeze the current state 36 00:03:48,780 --> 00:04:01,610 of the environment packages and this can be achieved by using this command Pip freeze and but to the 37 00:04:01,640 --> 00:04:05,030 virtual environment requirements text file. 38 00:04:05,510 --> 00:04:08,690 So what does this requirement text file 39 00:04:11,350 --> 00:04:19,120 the requirements file will hold the necessary dependencies for your project and this command the PIP 40 00:04:19,120 --> 00:04:30,010 freeze command creates a file called the requirement dot XT which has details about the packages with 41 00:04:30,010 --> 00:04:38,550 the warrants in the current environment and this file the requirement that text file would be really 42 00:04:38,550 --> 00:04:42,180 helpful for deploying the project or not different platform. 43 00:04:42,300 --> 00:04:48,900 Since all the project dependencies are already at your disposal indeed requirements file. 44 00:04:49,650 --> 00:04:57,150 So when you want to distribute up a project to others as it allows other programmers to install all 45 00:04:57,150 --> 00:05:04,290 the required packages with these requirements the text file in order to install the dependencies of 46 00:05:04,290 --> 00:05:05,460 the project. 47 00:05:05,460 --> 00:05:15,470 This is the command used pip install hyphen R and then part to the requirements by so in our system 48 00:05:15,500 --> 00:05:19,160 let's go ahead and create a requirements file. 49 00:05:22,720 --> 00:05:33,720 So this is the command to freeze the packages in a project so the Petraeus command will save the details 50 00:05:33,840 --> 00:05:40,220 about the packages with versions in the current environment in the requirements file. 51 00:05:40,410 --> 00:05:54,040 So let's open this file so here is the requirement file with these packages and the Washington numbers 52 00:05:55,290 --> 00:06:03,960 once we are done working in the virtual environment we can deactivated using the command deactivate 53 00:06:04,320 --> 00:06:14,000 the deactivate script is used to clear the currently active worldwide so let us deactivate the watch 54 00:06:14,010 --> 00:06:21,890 tool environment tutorial and this is the command D activate then hit enter the command prompt has been 55 00:06:21,890 --> 00:06:29,640 changed and deactivating a watch it environment will return us to the global environment. 56 00:06:29,870 --> 00:06:37,890 And this brings us to the end of the topic Pip and what Julian Wideman.