About the virtual environment in anaconda.

Asked 1 years ago, Updated 1 years ago, 458 views

Please point out the image in my brain when installing anacoda.
Assume that the operating system is installed on drive C and anaconda is installed on drive D.

The image below shows the virtual environment using anaconda.
The language used in the image is python.In addition, the anaconda prompt displays the anaconda in the middle right frame (base) environment.
--- ここIs this the right time?

After you create a virtual environment, for example, install a new library in virtual environment 1 or virtual environment 2.
--- このWhere will this library be installed at this time?

Enter a description of the image here

python anaconda

2022-09-30 21:59

2 Answers

The articles around here will be helpful.
[For beginners] Try creating a virtual environment with Anaconda
About Anaconda Virtual Environment
Python deployment in conda environment (commands, virtual environments, etc.)
conda commands:Python Environment Build Guide

ここIs this all right?

→ Yes, it is correct.
See the diagram in the first introduction.

このWhere will this library be installed?

→ Enter the activate environment at the time of installation.

Respond to comments:

You can see where it is installed by launching Anaconda Prompt (anaconda3) and activating the environment before running conda info --envs.
Verify, install, and update your version in conda
Change the standard directory where Anaconda's virtual environment is created
Summary of how to use the Anaconda command in a virtual environment

It is also loaded into the package cache in the sense of download.
You can see where the folder is by running conda info or conda config --show pkgs_dirs.


2022-09-30 21:59

[Python environment] I don't think it's right.

Assume that /a/b/c/d/bin has python or pip executables.
If you install the package with the pip executable, the file will be placed in the directory /a/b/c/d/lib/pythonX.Y/site-packages (where X.Y is the version number)
Launching the python executable there (without any special options) adds the above directory to the search path of the package.

The corresponding python executable exists in the pip executable and
The python executable file has a corresponding site-packages directory,
In fact, the concept called Python environment is based on this kind of system.

The term "virtual environment" is very simple to prepare a directory structure such as /a/b/c/d/bin or /a/b/c/d/lib/pythonX.Y/site-packages and place python-packages only in /a/b/c/d/bin.
And [switching between virtual environments] is simply
to ensure that the /a/b/c/d/bin path takes precedence over other locations.
(Changing the prompt is just a matter of fact.)

As for Python environment, there is no reason to separate Python environment from Anaconda's Python environment. There are differences in command options, usage, and where to create the directory, but I don't think the structure is different.

Other features of Anaconda are the Python environment.Anaconda also provides a non-Python binary image.

There is a package for Python that has a library written in C (as a Unix OS term) and provides only an interface to access it.
In that case, you must first install a library written in C language and keep it ready for useable.
Even if it's hard to prepare for Windows, Anaconda has the advantage of installing compiled binaries in the Anaconda directory.
Anaconda's feature is that it can easily create a closed environment that is separate from the operating system.

(Recently, when installing with pip, more and more binaries are included under site-packages, so I feel that Anaconda's value is less than before.)


2022-09-30 21:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.