As the comment at the top indicates, the output of
conda list -e > requirements.txt
can be used to create a conda
virtual environment with
conda create --name <env> --file requirements.txt
but this output isn't in the right format for pip
.
If you want a file which you can use to create a pip
virtual environment (i.e. a requirements.txt
in the right format)
you can install pip
within the conda
environment, the use pip to create requirements.txt
.
conda activate <env>
conda install pip
pip freeze > requirements.txt
Then use the resulting requirements.txt
to create a pip
virtual environment:
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
When I tested this, the packages weren't identical across the outputs (pip
included fewer packages) but it was sufficient to set up a functional environment.
For those getting odd path references in requirements.txt, use:
pip list --format=freeze > requirements.txt
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…