Add venv function
This commit is contained in:
parent
67e3527545
commit
ebc4254771
1 changed files with 12 additions and 0 deletions
12
bashrc.d/venv_function
Normal file
12
bashrc.d/venv_function
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
function venv() {
|
||||
if [ ${#} -gt 0 ]; then
|
||||
new_venv=${1}
|
||||
else
|
||||
echo "Name of the Python virtual environment:"
|
||||
read -r new_venv
|
||||
fi
|
||||
mkdir -p "${HOME}/pyenvs/${new_venv}"
|
||||
python -m venv "${HOME}/pyenvs/${new_venv}"
|
||||
source "${HOME}/pyenvs/${new_venv}/bin/activate"
|
||||
}
|
Loading…
Reference in a new issue