简体   繁体   中英

Once Anaconda is installed is there no need to install a virtual environment?

I am new to Python. Just installed Anaconda and everything works fine. also the documentation mentioned it is good to configure virtual environment.

Since Anaconda works like a virtual environment, I don't need to configure another virtual environment.

Right or wrong?

It is better to have separate environment for every project. Maybe one project needs some package version 1.3 and other needs 1.6. So it is much easier to have an environment for each project then to have one for all. If you had only one environment you would have to change update(change) packages every time you wanted to compile a project that needs some different versions.

Wrong, but also right.

Even when using Anaconda, it is good to use virtual environments (conda env) for each project so that you avoid issues with conflicting dependencies between projects. For example, one project you are working on requires Python 2.7 + flask 0.9 (not Python 3 compatible), whereas another project requires Python 3.4 + flask 0.11. The easiest way to manage these different dependencies is via conda virtual environments.

Note that conda envs function in a similar way to standard virtual environments, but do have a few differences. You are right in that you don't need traditional Python virtual environments any more. You still need to set up a new environment for each project, but this now becomes a conda env.

An additional benefit to using virtual environments is that you can easily create a requirements file which only contains the packages required for that project:

conda env export > environment.yml

If you try to do this outside your virtual environment, then you will end up putting every package you've ever installed into your environment.yml file.

http://conda.pydata.org/docs/using/envs.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM