Skip to content

Instantly share code, notes, and snippets.

@elmotec
Last active August 29, 2015 14:12
Show Gist options
  • Save elmotec/c48e4f88f66f0d2d039b to your computer and use it in GitHub Desktop.
Save elmotec/c48e4f88f66f0d2d039b to your computer and use it in GitHub Desktop.
Switch between versions of Python.
@rem remove any PYTHONHOME setting.
@set PYTHONHOME=
@rem first sets python path so we can run uniquepath.
@set PYTHON=C:\Python%1
@set PYTHONSTARTUP=%HOME%\scripts\startup.py
@dir %PYTHON% > NUL
@if ERRORLEVEL 1 GOTO FAILED
@set PATH=%PATH%;%PYTHON%
@rem Keep Python27 at the end of the PATH string to allow Vim to find Python27.dll
call uniquepath --remove *Python* --append %PYTHON% --append %PYTHON%\Scripts PATH --append %PYTHON%\Tools\Scripts --append C:\Python27
@goto SUCCESS
:FAILED
@echo %PYTHON% is not a valid directory.
@set ERRORLEVEL=1
:SUCCESS
@rem Keep pylint directory local.
@SET PYLINTHOME=pylint.d
@exit /B %ERRORLEVEL%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment