venv - GitDro/tech-tips GitHub Wiki
Within project directory run:
python3 -m venv my-env-name
or could always make it hidden with:
python3 -m venv .my-venv-name
To start virtual env, run:
source my-env-name/bin/activate
which integrates nicely with vscode, run deactivate
to stop.
While working with git:
- ignore env from source control
echo 'my-env-name' > .gitignore
- instead save requirements with
pip3 freeze > requirements.txt
Install needed packages on another machine:
- cd to the directory where requirements.txt is located.
- activate your virtualenv.
- run:
pip install -r requirements.txt
in your shell.
When creating new branch right in vscode:
To push the current branch and set the remote as upstream, use
`git push --set-upstream origin branch-name`