C:\Python27\workon.bat
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
@echo off | |
if not defined WORKON_HOME ( | |
set "WORKON_HOME=%USERPROFILE%\Envs" | |
) | |
if not defined VIRTUALENVWRAPPER_PROJECT_FILENAME ( | |
set VIRTUALENVWRAPPER_PROJECT_FILENAME=.project | |
) | |
if [%1]==[] goto LIST | |
goto WORKON | |
:LIST | |
echo. | |
echo Pass a name to activate one of the following virtualenvs: | |
echo ============================================================================== | |
dir /b /ad "%WORKON_HOME%" | |
goto END | |
:WORKON | |
if defined VIRTUAL_ENV ( | |
call "%VIRTUAL_ENV%\Scripts\deactivate.bat" | |
) | |
pushd "%WORKON_HOME%" 2>NUL && popd | |
if errorlevel 1 ( | |
mkdir "%WORKON_HOME%" | |
) | |
pushd "%WORKON_HOME%\%1" 2>NUL && popd | |
if errorlevel 1 ( | |
echo. | |
echo. virtualenv "%1" does not exist. Create it with "mkvirtualenv %1" | |
goto END | |
) | |
call "%WORKON_HOME%\%1\Scripts\activate.bat" | |
REM set virtualenv | |
set PYTHONPATH=%VIRTUAL_ENV%\Lib;%VIRTUAL_ENV%\Lib\site-packages | |
ftype Python.File=%WORKON_HOME%\Scripts\python.exe | |
if exist "%WORKON_HOME%\%1\%VIRTUALENVWRAPPER_PROJECT_FILENAME%" ( | |
call cdproject.bat | |
) | |
:END |
C:\Python27\toggleglobalsitepackages.bat
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
@echo off | |
:MAIN | |
if not defined VIRTUAL_ENV ( | |
echo. | |
echo You must have an active virtualenv to use this command. | |
goto END | |
) | |
set "file=%VIRTUAL_ENV%\Lib\no-global-site-packages.txt" | |
if exist "%file%" ( | |
del "%file%" | |
REM set global | |
ftype Python.File=%~dp0\python.exe | |
echo. | |
echo. Enabled global site-packages | |
goto END | |
) else ( | |
type nul >>"%file%" | |
REM set virtualenv | |
set PYTHONPATH=%VIRTUAL_ENV%\Lib;%VIRTUAL_ENV%\Lib\site-packages | |
ftype Python.File=%VIRTUAL_ENV%\Scripts\python.exe | |
echo. | |
echo. Disabled global site-packages | |
) | |
set file= | |
:END |
No comments :
Post a Comment