Following the thankful youtube links, just had succeeded easily to install tensorflow through my Anaconda Prompt.
What I had done is :
1) conda create -n tensor2 python=3
first I had created a virtual environment names tensor2(I don't know why do I need this) and also What does -n refer to?
2) then activate tensor2 Virtual Environment then run the pip install tensorflow
.
So Wrapping up the question:
1) Why do I need to create Virtual Enviornmnet especially for module tensorflow while other modules are just using pip install instantly?
2) additional question is, what does -n refer to at above command? and also, what does -m refer to in the statement "python -m pip install /module name/'?
A virtual environment is simply a tool that separates the dependencies of different projects by creating a separate isolated environment for each project. These are simply the directories so that unlimited virtual environments can be created.
In a nutshell, Python virtual environments help decouple and isolate Python installs and associated pip packages. This allows end-users to install and manage their own set of packages that are independent of those provided by the system or used by other projects.
A virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them. This is one of the most important tools that most of the Python developers use.
Using a requirements. In a virtual environment, it's a good habit to install specific versions of packages. It ensures that you reap the full benefits of using virtual environments in the first place. After all, we do this to make sure our software always works as intended by fixating to specific dependency versions.
What does -n refer to in conda create
https://conda.io/docs/using/envs.html#create-an-environment --name or -n just defines what the environment will be named after.
What does -m refer to in python -m
The -m flag search for a given module (in your case it searches for the pip module) and if found, it runs the __main__
function (if you simply run python -m pip it will display the help output). And 'intall module' are then the arguments passed to pip. This is often done to circumvent that 'pip' would not be in your path but that python would be able to locate it (throught its python path).
Why do you need virtual environments ?
Well actually you don't. Why are people suggesting to use them ? Because it gives you some more isolated environments to experiment with, without 'damaging' the rest of your system, if you experiment a lot there is chance the some dependencies could go in conflict and it also allows you to switch between different versions. If you plan to only use one environment and keep it up to date (or freeze it to a certain version) then there's no need to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With