Skip to content

Instantly share code, notes, and snippets.

@operatorequals
Last active March 30, 2019 01:17
Show Gist options
  • Save operatorequals/90fda280dc007386116053bb9bcb9db5 to your computer and use it in GitHub Desktop.
Save operatorequals/90fda280dc007386116053bb9bcb9db5 to your computer and use it in GitHub Desktop.
This script will create the aliases python-win, pip-win, pyinstaller-win to a debian installation
#!/bin/bash
PY2_DL="https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi"
TMP_DIR="/tmp/python-win"
PY2_FILE="$TMP_DIR/python2.msi"
PY2_DIR="Python27"
echo "This script will create the aliases python-win, pip-win, pyinstaller-win to a debian installation"
mkdir -p "$TMP_DIR"
cd "$TMP_DIR"
echo 'Installing wine'
apt install -y wine
# dpkg --add-architecture i386 && apt-get update && apt-get install wine32
echo "Downloading Python 2"
wget "$PY2_DL" -O "$PY2_FILE"
wine msiexec /i "$PY2_FILE" /quiet TARGETDIR="C:\\$PY2_DIR\\" ALLUSERS=1 ADDLOCAL=DefaultFeature,Tools
echo "Registering python-win and pip-win"
echo 'alias python-win="wine ~/.wine/drive_c/Python27/python.exe"' >> ~/.bashrc
echo 'alias pip-win="wine ~/.wine/drive_c/Python27/Scripts/pip.exe"' >> ~/.bashrc
echo "Upgrading pip"
wine ~/.wine/drive_c/Python27/Scripts/pip.exe install --upgrade pip
echo "Installing PyInstaller for Wine"
wine ~/.wine/drive_c/Python27/Scripts/pip.exe install pyinstaller
echo alias 'pyinstaller-win="wine ~/.wine/drive_c/Python27/Scripts/pyinstaller.exe"' >> ~/.bashrc
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment