Skip to content

Instantly share code, notes, and snippets.

@jsyeo
Last active February 15, 2022 05:10
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsyeo/6276896 to your computer and use it in GitHub Desktop.
Save jsyeo/6276896 to your computer and use it in GitHub Desktop.
Batch file to create virtualenv, download and install distribute + pip on Windows 7 machines (Python 3.3)
cd %USERPROFILE%
REM create the venv
C:\Python33\python.exe C:\Python33\Tools\Scripts\pyvenv.py %USERPROFILE%\venv
REM download get-pip.py and distribute_setup.py
powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py','%USERPROFILE%\get-pip.py')
powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('http://python-distribute.org/distribute_setup.py','%USERPROFILE%\distribute_setup.py')
REM create idle in Scripts
echo (%USERPROFILE%\venv\Scripts\python -c "from idlelib.PyShell import main; main()" ^& pause) >> %USERPROFILE%\venv\Scripts\idle.bat
REM activate the venv, install distribute, install pip, create IDLE shortcut in desktop, install PILLOW
%USERPROFILE%\venv\Scripts\activate.bat & python distribute_setup.py & python get-pip.py & powershell.exe -Command $shortcut = (New-Object -comObject WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\idle.lnk'); $shortcut.TargetPath = '%USERPROFILE%\venv\Scripts\idle.bat'; $shortcut.Save() & pip install pillow
REM Now you can use pip install python_package to install your packages
REM to use the IDLE, just open the shortcut in your desktop
REM Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment