Builds python from source and installs to ~/.local/share/python/python-version without requiring sudo privileges.
Specify python version when calling the script and it will download, build and install the specified python version from python.org
sh ./install_python.sh 3.8.1Check installation of Python in a new terminal with
python3.8 --version
Note: Make sure you have ~/.local/bin added to you PATH. If not, add export PATH="$HOME/.local/bin:$PATH" to .bashrc
| Argument | Required | Type | Default | Description |
|---|---|---|---|---|
| version | required | string (version number) | null | Version Number. Example: 3.8.10 |
| install_path | optional | string (path, will be created if it does not exist) | $HOME/.local/share/python/$PYTHON_VERSION | Path will be created if it does not exist |
| --symlink | optional | null | null | Symlink will be created at $HOME/.local/bin |
If you would like to access directly using python3 or python, you can add symlinks as shown below:
cd ~/.local/bin/
ln -s python3.8 python3
ln -s python3 python
cd -
python --version