This guide covers Python installation on Linux using python-build-standalone portable builds.
- Linux with glibc 2.17+ (most modern distributions)
- curl
- tar
- Internet access
- ~150 MB free disk space
# Make script executable
chmod +x bootstrap-unix.sh
# Run the bootstrap script
./bootstrap-unix.sh
# For a fresh reinstall
./bootstrap-unix.sh --force| Architecture | Build Used |
|---|---|
| x86_64 (Intel/AMD 64-bit) | x86_64-unknown-linux-gnu |
| aarch64 (ARM 64-bit) | aarch64-unknown-linux-gnu |
The script automatically detects your architecture.
Default: $HOME/.python-nonadmin
This typically resolves to:
/home/YourUsername/.python-nonadmin
.python-nonadmin/
├── bin/
│ ├── python3 # Main Python interpreter
│ ├── python3.12 # Version-specific symlink
│ ├── pip3 # Package installer
│ └── ...
├── lib/
│ └── python3.12/ # Standard library
│ ├── site-packages/
│ └── ...
├── include/ # Header files
└── share/ # Documentation
The python-build-standalone builds work on most Linux distributions:
| Distribution | Status |
|---|---|
| Ubuntu 18.04+ | ✅ Supported |
| Debian 10+ | ✅ Supported |
| Fedora 30+ | ✅ Supported |
| CentOS/RHEL 7+ | ✅ Supported |
| Arch Linux | ✅ Supported |
| Alpine Linux | |
| Older distributions |
The default builds require glibc 2.17 or later. Check your version:
ldd --versionIf your glibc is older, you have two options:
Edit config.json to use musl builds:
"linux_x86_64": "cpython-3.12.8+20241206-x86_64-unknown-linux-musl-install_only.tar.gz"For maximum compatibility, build Python from source in your home directory (beyond scope of this tool).
The script modifies your shell profile:
| Shell | Profile Modified |
|---|---|
| Bash | ~/.bashrc or ~/.bash_profile |
| Zsh | ~/.zshrc |
| Fish | ~/.config/fish/config.fish |
Most Linux distributions include a system Python:
# Check which python is active
which python3
# System Python locations
/usr/bin/python3 # Debian/Ubuntu
/usr/bin/python3.x # Fedora
# User Python
~/.python-nonadmin/bin/python3Important: Never uninstall or break system Python on Linux, as many system tools depend on it.
On shared systems (university clusters, shared servers):
- The installation is completely within your home directory
- No system-wide changes are made
- Your Python won't affect other users
- You can install packages without sudo
# Install packages to your personal Python
pip3 install numpy pandas matplotlib
# Create virtual environments
python3 -m venv ~/my-project-envOn HPC systems with module systems:
# Don't load system Python modules
# module unload python # If needed
# Use your personal Python
source ~/.python-nonadmin/bin/activate.shFor corporate or university networks:
# Set before running bootstrap
export HTTP_PROXY="http://proxy.company.com:8080"
export HTTPS_PROXY="http://proxy.company.com:8080"
export NO_PROXY="localhost,127.0.0.1"
# Run
./bootstrap-unix.shFor permanent pip proxy:
pip config set global.proxy http://proxy.company.com:8080On SELinux-enabled systems (RHEL, Fedora, CentOS), the binaries should work without issues since they're in your home directory. If you encounter permission errors:
# Check SELinux status
getenforce
# Temporarily set permissive (if you have access)
sudo setenforce 0
# Or restore proper context
restorecon -Rv ~/.python-nonadminRestart your terminal or source your profile:
source ~/.bashrc
# or
source ~/.zshrcThis usually indicates glibc version mismatch:
# Check glibc version
ldd --version
# If too old, try musl build (edit config.json)Install CA certificates:
# Ubuntu/Debian
sudo apt-get install ca-certificates
# Fedora/RHEL
sudo dnf install ca-certificates
# Or use pip's bundled certificates
pip3 install certifiEnsure the script and binaries are executable:
chmod +x bootstrap-unix.sh
chmod -R +x ~/.python-nonadmin/bin/# Remove installation directory
rm -rf ~/.python-nonadmin
# Remove PATH configuration from shell profile
# For Bash:
sed -i '/Python-NoAdmin/d' ~/.bashrc
# For Zsh:
sed -i '/Python-NoAdmin/d' ~/.zshrcFor containerized environments:
# In Dockerfile (as non-root user)
RUN curl -LO https://github.com/.../bootstrap-unix.sh && \
chmod +x bootstrap-unix.sh && \
./bootstrap-unix.sh
ENV PATH="/home/user/.python-nonadmin/bin:$PATH"