Created
January 4, 2016 11:20
-
-
Save nicoddemus/293d4b048c4673e80e2a to your computer and use it in GitHub Desktop.
get requirements from current conda env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
from __future__ import print_function | |
import json | |
import subprocess | |
libs = json.loads(subprocess.check_output('conda list -e --json', shell=True)) | |
lines = [] | |
for name in libs: | |
lines.append('-'.join(name.split('-')[:-2]) + '\n') | |
with open('requirements.txt', 'w') as f: | |
f.writelines(lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment