Use conda as a tool to distribute and re-generate the virtual python environment

Jimmy Ye
Feb 4, 2022

--

  1. Install miniconda: https://docs.conda.io/en/latest/miniconda.html
  2. Open the “Anaconda prompt (Miniconda3)”
  3. Create the virtual environment ‘conda env create — name venvname’
  4. Then use the ‘conda install’ to install the required packages.
  5. Use ‘conda env export — name <venvname> > environment.yaml
  6. Trick: The auto-generated the YAML file is very verbose, can be significantly simplified manually to only explicitly include what’s required, such as numpy/matplotlib/OpenCV.
  7. Then other people can use ‘conda env create — file environment.yaml” to create the same python environment.
  8. Use ‘conda activate venvname’ to activate this virtual environment and then run your python program.

--

--

No responses yet