Skip to content

sanmussh/install-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

install-python

One-command Python source installer for Linux.πŸ˜€

This script downloads official CPython source code, installs build dependencies, compiles Python, installs it under /opt/python/<version> by default, and creates safe command links in /usr/local/bin.

Quick Start

Install the default Python version:

curl -fsSL https://raw.githubusercontent.com/sanmussh/install-python/main/install-python.sh | bash

After installation, use:

python3.14
pip3.14

Install a Specific Version

curl -fsSL https://raw.githubusercontent.com/sanmussh/install-python/main/install-python.sh | bash -s -- --version 3.14.6

Make python and pip Point to the New Installation

By default, this script does not change python or pip.

If you want python and pip to point to the installed version, use:

curl -fsSL https://raw.githubusercontent.com/sanmussh/install-python/main/install-python.sh | bash -s -- --version 3.14.6 --set-default

This creates:

/usr/local/bin/python -> /opt/python/3.14.6/bin/python3.14
/usr/local/bin/pip    -> /opt/python/3.14.6/bin/pip3.14

It does not delete or overwrite /usr/bin/python, /usr/bin/python3, or /usr/bin/pip.

Set Default Later Without Reinstalling

If you first installed with the default behavior and later want python and pip to point to that existing installation, use:

curl -fsSL https://raw.githubusercontent.com/sanmussh/install-python/main/install-python.sh | bash -s -- --version 3.14.6 --set-default-only

This only creates command links. It does not download, build, or reinstall Python.

Custom Install Directory

curl -fsSL https://raw.githubusercontent.com/sanmussh/install-python/main/install-python.sh | bash -s -- --version 3.14.6 --prefix /usr/local/python

The final install directory will be:

/usr/local/python/3.14.6

Safer Two-Step Install

If you want to inspect the script first:

curl -fsSL https://raw.githubusercontent.com/sanmussh/install-python/main/install-python.sh -o install-python.sh
bash install-python.sh --version 3.14.6

Options

--version VERSION     Python version to install. Default: 3.14.6
--prefix PATH         Base install directory. Default: /opt/python
--set-default         Also create python and pip commands in /usr/local/bin
--set-default-only    Only make python and pip point to an existing installation
--skip-deps           Skip dependency installation
--upgrade-pip         Upgrade pip, setuptools, and wheel from PyPI after install
--keep-build-dir      Keep the temporary build directory
-h, --help            Show help

Where Things Are Installed

For Python 3.14.6, the real installation is:

/opt/python/3.14.6

The versioned command links are:

/usr/local/bin/python3.14
/usr/local/bin/pip3.14

If --set-default is used, these links are also created:

/usr/local/bin/python
/usr/local/bin/pip

Supported Systems

The script supports common Linux distributions that use:

  • apt-get, such as Ubuntu and Debian
  • dnf, such as Fedora, modern RHEL, CentOS Stream, AlmaLinux, and Rocky Linux
  • yum, such as older CentOS and RHEL systems

Uninstall

For Python 3.14.6, remove the install directory and command links:

sudo rm -rf /opt/python/3.14.6
sudo rm -f /usr/local/bin/python3.14 /usr/local/bin/pip3.14

If you used --set-default, also remove:

sudo rm -f /usr/local/bin/python /usr/local/bin/pip

About

One-command Python source installer for Linux.πŸ˜€

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages