So guys, one of the most important question that I've been asked by many people who implement end to
end project, that is with respect to creating an environment.
Now, there are multiple ways in creating an environment, uh, for a project.
And it is always a good idea that you probably create a separate environment for every project because
you have a different set of dependencies and libraries that you need to install over there.
Now, considering this right, I usually in my YouTube channel I use conda command to create a environment
itself.
Right.
And many people do not have anaconda installed, they just have Python installed.
So due to that they get some kind of error.
Right?
You can also create an environment through this Python command which I'm going to show you.
So again in this video what all things I'm actually going to cover all the different ways how you can
probably create an environment and start your end to end project itself.
So let me quickly go ahead and show you.
I'm going to show you three different ways.
I'll open my terminal.
Okay.
And the best thing is that you can use along with you can use as a Linux command.
Also you can use as in Windows Command Prompt also.
So let me just show you the first way.
The first way will be using python command right conda create command I usually show you.
But today I will show you all the three ways how you can actually do it.
So let me go ahead and write by using the Python command.
So I will write p y t h and python okay.
And then here I will go ahead and write minus m okay.
And my command name that is v and v inside what folder.
Okay.
So here let's say my folder is y my e and v.
So once I do this this folder will automatically get created okay.
And by default my a environment will be set up.
Now inside this particular environment, what kind of, uh, Python version you specifically have for
that?
First of all, let's go ahead and activate it okay.
Now to activate this, what I will do inside my me env there will be include libraries folders and all
inside script.
There is one activate file.
So I just need to go ahead and activate this to activate this particular environment.
So for that what I will do I will write my env slash scripts slash activate okay.
So once I write this and now here you can see that my environment is activated.
Now I can probably go ahead and install any kind of libraries that I specifically want.
Let's say pip install pandas.
If I do or pip install numpy, then automatically the numpy will get installed in this specific library.
Okay.
And later on, if you have many number of libraries, you can basically create a requirement dot txt
for this.
The prerequisite is that you only need to have python installed.
Now, which version of Python is probably getting installed over here that also you really need to check
by default.
Let's say in my Python environment right now I just shot right.
Let's let's go and see my Python version.
So let me go ahead and write Python version.
So inside my Python version oops.
You can see Python 3.8.5 is there, right?
So by default whenever I create an environment.
So this Python 3.85 only will get created.
Because in my system I have this specific thing installed.
Let's say I want to create with another Python version.
Then I need to upgrade my Python package itself, right?
I need to probably make it to 3.1. 3.1.0 or 3.1.2.
What I need to do is that just go to Google, okay?
And probably let's say I go to python.org and here I download the recent version.
Now automatically.
What will happen is that whenever I create an environment that through that way then I will get this
specific version.
So this is one way okay.
The another way.
So let me quickly I've activated it.
Now I will go ahead and deactivate it.
I will clear the screen.
So this is one environment that has got created.
Now there is also another way which we specifically use for Linux.
Uh, Linux commands itself.
So first of all I will go ahead and install virtualenv.
So this virtual env sorry I think it will get an error.
So virtual env this I will try to install.
So once I probably install virtualenv I'll show you how you can create a command an environment through
using virtual envy itself, and that also you can also use it in PowerShell or Good Bash.
So in Virtual Envy I will go ahead and write virtual envy okay.
And after writing virtual envy, let me go and go ahead and write it minus pi P.
And then I will go ahead and write Python.
Okay.
Python the version I know that it is somewhere around three.
And this will basically be my virtual environment name virtual underscore EMV.
So once I go ahead and execute it, you'll be able to see that now inside this virtual EMV is also getting
created.
And inside this also you have a script folder.
So if you want to activate somewhere activate via.
This will also be there right?
Activate file will be there to activate those commands.
So in order to activate it what I will do, I will quickly go ahead and clear the screen and go ahead
and write virtual env I think the the folder name is virtual envy, I guess.
Let's see.
Virtual underscore envy.
So slash scripts slash back slash activate.
So once I activate now here you can see I'm getting some error.
Let's see what is the file name.
Scripts.
Scripts?
Uh, slash.
I think the spelling is somewhere here itself.
Let's see.
I will go ahead and copy this path.
Okay.
Oops.
Let me just see.
Okay.
Activate.
Activate, activate.
I will copy the relative path.
I'll paste it over there.
Now I think it should be.
Now you can see that it has got, uh.
It moves into this particular virtual environment.
Now, in order to deactivate, I will go ahead and deactivate.
Okay.
Now, this is the thing, right?
Uh, through this, what you really need to do is that whenever you upgrade your Python, you'll be
able to create that particular Python, uh, environment with that particular Python version In this,
the third way, which is the most common way in which I also use is by using conda create.
For this you really need to have Anaconda installed, and Anaconda is a better way I feel, because
here you will be able to, you know, make sure that all the packages, all the environments are properly
managed through the Anaconda environment.
You can actually see each and every packages that has got installed.
So you can also use this specifically.
And for this way you only have to write conda create minus p v and v.
Let's say v and v one.
And here I will give my python version with respect to anything that I want 3.10 and dot and y.
Right.
So this command actually helps you to create an environment even though in the base you have different
Python version.
See right now you have Python version Python v okay I will write python dash dash v.
So here okay.
Version okay Python 3.8.5.
Right now what I will do is that I will make sure that I create it through the conda.
So I will write conda create minus p v and v one python.
Let's say I want to go with higher version.
Python double equal to 3.10.
Right.
And if I write w dash y then you can see that automatically.
My entire environment will get created right.
So I still find this as an efficient way.
But again if you don't have Anaconda and whenever because many, many people are getting this kind of
errors when they are doing my project because I only use Conda because that is much more efficient when
I compare it to Python, But it is not possible.
I'm not saying that it is impossible to create in other ways.
You can go with that.
So that is the reason I have shown you all the specific ways to go ahead, and you can create a virtual
environment based on your needs.
So I hope you like this particular video.
This was it for my side.
And this was the video about creating different ways of environment in your Python projects itself.
Uh, yes.
Go ahead and try it out and if you have any queries, please let me know in the comment section of this
particular video.