mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-19 03:56:16 +00:00
feat: add python installer
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
---
|
||||
title: Python 2 (via pyenv)
|
||||
homepage: https://webinstall.dev/pyenv
|
||||
tagline: |
|
||||
Python 2 is the legacy version of Python.
|
||||
---
|
||||
|
||||
To update or switch versions, run `pyenv install -v 2` (or `2.6`, etc).
|
||||
|
||||
### How to Install python2 on macOS
|
||||
|
||||
Make sure that you already have Xcode tools installed:
|
||||
|
||||
```bash
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
You may also need to install Xcode proper from the App Store.
|
||||
|
||||
### How to Install python2 on Linux
|
||||
|
||||
Make sure that you already have the necessary build tools installed:
|
||||
|
||||
```bash
|
||||
# required
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential zlib1g-dev libssl-dev
|
||||
|
||||
# recommended
|
||||
sudo apt install -y libreadline-dev libbz2-dev libsqlite3-dev
|
||||
```
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```txt
|
||||
~/.bashrc (or your shell's equivalent)
|
||||
~/.config/envman/PATH.env
|
||||
~/.pyenv
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||

|
||||
|
||||
Unless you know you need Python 2 for a specific purpose, you should probably
|
||||
use [Python 3](/python) instead.
|
||||
|
||||
For more info see these cheat sheets:
|
||||
|
||||
- [Python 3](/python)
|
||||
- [pyenv](/pyenv)
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function __init_python2() {
|
||||
if [[ ! -x "${HOME}/.pyenv/bin/pyenv" ]]; then
|
||||
"${HOME}/.local/bin/webi" "pyenv"
|
||||
fi
|
||||
export PATH="${HOME}/.pyenv/bin:${PATH}"
|
||||
export PATH="${HOME}/.pyenv/shims:${PATH}"
|
||||
|
||||
#eval "$(pyenv init -)"
|
||||
#eval "$(pyenv virtualenv-init -)"
|
||||
|
||||
pyenv update
|
||||
|
||||
my_latest_python2="$(
|
||||
pyenv install --list |
|
||||
grep -v -- - |
|
||||
grep '2\.[0-9]\+\.[0-9]\+$' |
|
||||
tail -n 1 |
|
||||
cut -d' ' -f3
|
||||
)"
|
||||
|
||||
#my_python="${WEBI_VERSION:-${my_latest_python2}}"
|
||||
my_python="${my_latest_python2}"
|
||||
echo "Installing ${my_python}"
|
||||
pyenv install -v "${my_python}"
|
||||
pyenv global "${my_python}"
|
||||
|
||||
echo ''
|
||||
echo 'NOTE: You may also need to CLOSE and RE-OPEN your terminal for pyenv to take effect.'
|
||||
echo '(to switch versions of python, see https://webinstall.dev/pyenv)'
|
||||
echo ''
|
||||
}
|
||||
|
||||
__init_python2
|
||||
Reference in New Issue
Block a user