Skip to content

Instantly share code, notes, and snippets.

@nicoddemus
Created January 4, 2016 11:20
Show Gist options
  • Save nicoddemus/293d4b048c4673e80e2a to your computer and use it in GitHub Desktop.
Save nicoddemus/293d4b048c4673e80e2a to your computer and use it in GitHub Desktop.
get requirements from current conda env
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