[Python] Difference between environment in local /.conda/ subdirectory and environments in...

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to get back into python, working on a unix system. I'm trying to understand virtual environments, to keep all my packages organized, and am struggling with the difference between conda environments localized in a project directory with a /.conda/ subdirectory, and conda environments that live in conda_intallation_folder/envs/

    I was reading the VSCode docs on venvs and understand the following:


    A virtual environment creates a folder that contains a copy (or symlink) to a specific interpreter. When you install packages into a virtual environment it will end up in this new folder, and thus isolated from other packages used by other workspaces.
    ​

    My question is specifically about the difference between conda enviroments that could be created with

    conda create -n ENV_NAME python=PYTHON_VERSION


    which I understand I would have to activate, with

    conda activate env_name_or_prefix


    and the conda environments I created through VSCode's Command Pallet, choosing Select Interpreter --> create virutal environment, which creates the local /.conda/ subdirectory.

    I understand that both of these operations create an isolated interpreter with a unique set of packages.

    I want to better understand the difference between these two approaches to creating the isolated interpreter, so I can make sure I'm accessing the environment I want and not accidentally tossing everything into global. Many thanks!

    Continue reading...

Compartilhe esta Página