Skip to content

Instantly share code, notes, and snippets.

@VictorieeMan
Last active July 13, 2022 15:16
Show Gist options
  • Save VictorieeMan/c94b2a3410cd9ef9a17a95690afece1f to your computer and use it in GitHub Desktop.
Save VictorieeMan/c94b2a3410cd9ef9a17a95690afece1f to your computer and use it in GitHub Desktop.
Installing viritual Python3 environments of different versions
Source: https://www.roelpeters.be/virtualenv-venv-choose-python-version/
Documentation: https://virtualenv.pypa.io/en/stable/
python -m pip install --user virtualenv
python -m virtualenv --help
py -m virtualenv -p=<your_python_executable> <virtual_environment_directory>
Example use:
py -m virtualenv -p="C:\Program Files\Python37\python.Exe" .virtenv
.virtenv\Scripts\activate
Or more simply:
py -m virtualenv .virtenv
.virtenv\Scripts\activate
Run to save inventory of modules in use:
pip freeze > requirements.txt
Run to install from requirements.txt tile in fresh installs.
pip install -r /path/to/requirements.txt
Ubuntu:
python3.7 -m virtualenv virtenv
virtenv/bin/activate
This is also useful to consider when using the viritual environment within a Git:
https://stackoverflow.com/questions/51863155/do-we-need-to-upload-virtual-env-on-github-too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment