[Python] Can't activate Python environment after creating it in bash [duplicate]

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

  1. Stack

    Stack Membro Participativo

    I have the following script myenv.sh:

    #!bin/bash
    echo "####### Install automated template ########"
    python3 -m venv .venv
    source .venv/bin/activate
    pip install --upgrade pip
    pip install ipykernel pandas seaborn scikit-learn
    echo "######## Done ########"


    So I run the script, and it creates the environment but doesn't stay activated. Perhaps it is exiting. So I tried this:

    #!bin/bash
    echo "####### Install automated template ########"
    python3 -m venv .venv
    source .venv/bin/activate
    pip install --upgrade pip
    pip install ipykernel pandas seaborn scikit-learn
    source ${PWD}/.venv/bin/activate
    echo "######## Done ########"


    But nothing happens. Please, could you point out what I am doing wrong?

    Continue reading...

Compartilhe esta Página