Advertisement
overloop

jupyter-notebook.py

Dec 8th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import os
  2. import subprocess
  3.  
  4. base = 'C:\\data'
  5. jupyter_dir = os.path.join(base,'.jupyter')
  6. if not os.path.exists(jupyter_dir):
  7.   os.mkdir(jupyter_dir)
  8.  
  9. dirs = {'JUPYTER_CONFIG_DIR' : jupyter_dir, 'JUPYTER_RUNTIME_DIR' : os.path.join(jupyter_dir,'runtime'),'JUPYTER_DATA_DIR' : os.path.join(jupyter_dir,'data')}
  10.  
  11. for k,v in dirs.iteritems():
  12.   if not os.path.exists(v):
  13.     os.mkdir(v)
  14.   os.environ[k] = v
  15.  
  16. ipython_dir = os.path.join(base,'.ipython')
  17.  
  18. if not os.path.exists(ipython_dir):
  19.   subprocess.call(['cmd.exe','/C', 'mklink','/J',ipython_dir,'%USERPROFILE%\\.ipython'])
  20.  
  21. os.environ['IPYTHONDIR'] = ipython_dir
  22.  
  23. subprocess.call(['C:\\Python27\\Scripts\\jupyter-notebook.exe'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement