Skip to content

Instantly share code, notes, and snippets.

@mgoodfellow
Last active March 7, 2017 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgoodfellow/8d1f751f60e5c159964659df99c85c24 to your computer and use it in GitHub Desktop.
Save mgoodfellow/8d1f751f60e5c159964659df99c85c24 to your computer and use it in GitHub Desktop.
Quick script to create venv with patched pip version on Python 3.6 on Windows
#!/bin/bash
# This is a handy script to apply a pip fix to the venv created by python 3.6 on Windows
# Written by Mike Goodfellow in a few minutes - feel free to improve this!!
# Based on information in https://github.com/pypa/pip/issues/3964
#
# NOTE: Currently works if python on path points to python3 which is commonly
# does on Windows.
if [ $# -ne 1 ]
then
echo "Usage: venv_init /path/to/venv"
exit 1
fi
echo "Creating new venv in $1..."
# NOTE: This needs to be on the path...
python -m venv $1
echo "Applying the pip fix..."
rm -rf $1/Lib/site-packages/pip*
$1/Scripts/easy_install pip
$1/Scripts/pip install --upgrade pip setuptools
echo "Patched version of venv has been configured in $1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment