Answers for "create requirements.txt from virtualenv"

17

pip freeze requirements.txt

// capture requirements to install
pip freeze > requirements.txt

// install requirements from requirements.txt
pip install -r requirements.txt

// or
$ env1/bin/pip freeze > requirements.txt
$ env2/bin/pip install -r requirements.txt
Posted by: Guest on June-07-2020
1

create virtualenv from requirements.txt

py -m pip install -r requirements.txt
Posted by: Guest on June-20-2021
0

create requirements file and load it in new envirnment.

$ conda list -e > req.txt
$ conda create -n <environment-name> --file req.txt
Posted by: Guest on June-12-2021
1

python create requirements.txt

import subprocess
result = subprocess.run(["pip", "freeze"], capture_output=True, text=True, shell=True)
with open('requirements.txt', 'w') as d:
    for line in result.stdout.split('\n'):
        d.write(line.split('==')[0]+'\n')  
        # ".split('==')[0]" seperates name from version
Posted by: Guest on July-10-2021

Code answers related to "create requirements.txt from virtualenv"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language