Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marhensa/52617ce599bc0587f36f42fc1d11b251 to your computer and use it in GitHub Desktop.
Save marhensa/52617ce599bc0587f36f42fc1d11b251 to your computer and use it in GitHub Desktop.

apt-get update -y

wget -qO- https://astral.sh/uv/install.sh | sh

source $HOME/.local/bin/env

alias pip='uv pip' && source ~/.bashrc

uv python install 3.12

uv venv --python 3.12

mkdir -p .venv/lib/python3.12/site-packages/pip

nano .venv/lib/python3.12/site-packages/pip/__main__.py

import sys, subprocess

if __package__ is None and not getattr(sys, 'frozen', False):
    # direct call of __main__.py
    import os.path
    path = os.path.realpath(os.path.abspath(__file__))
    sys.path.insert(0, os.path.dirname(os.path.dirname(path)))

if __name__ == '__main__':
    ls=['uv', 'pip'] + sys.argv[1:]
    subprocess.check_call(ls)

chmod +x .venv/lib/python3.12/site-packages/pip/__main__.py

source .venv/bin/activate

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Add-Content -Path $PROFILE.CurrentUserAllHosts -Value "function pip { uv pip @args }"

. $PROFILE.CurrentUserAllHosts

uv python install 3.12

uv venv --python 3.12

$filePath = ".venv/lib/site-packages/pip/__main__.py"

New-Item -ItemType File -Path $filePath -Force # Creates the file if it doesn't exist

notepad.exe $filePath # Opens in Notepad

import sys, subprocess

if __package__ is None and not getattr(sys, 'frozen', False):
    # direct call of __main__.py
    import os.path
    path = os.path.realpath(os.path.abspath(__file__))
    sys.path.insert(0, os.path.dirname(os.path.dirname(path)))

if __name__ == '__main__':
    ls=['uv', 'pip'] + sys.argv[1:]
    subprocess.check_call(ls)

.venv\Scripts\activate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment