Answers for "generate requirements.txt from python file"

23

python requirements.txt

pip freeze #view requirements to be created (best done in virtual env)
pip freeze > requirements.txt #create requirements.txt (best done in virtual env)
pip install -r requirements.txt #install requirements.txt (best done in virtual env)
Posted by: Guest on December-10-2019
8

how to generate requirements.txt django

For Unix families: pip3 freeze > requirements.txt
For Windos: pip freeze > requirements.txt
Posted by: Guest on May-02-2020
0

how to have requirement file in python for libs

pip3 freeze > requirements.txt
Posted by: Guest on October-16-2020
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 "generate requirements.txt from python file"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language