Skip to content

Instantly share code, notes, and snippets.

@PaulCreusy
Last active July 25, 2025 07:09
Show Gist options
  • Select an option

  • Save PaulCreusy/6b679995d44d1e2af9c312186401170b to your computer and use it in GitHub Desktop.

Select an option

Save PaulCreusy/6b679995d44d1e2af9c312186401170b to your computer and use it in GitHub Desktop.
How to install Python from source

How to install Python from source

1. Download Python from source

Download the desired Python version at this address: https://www.python.org/downloads/source/

2. Unzip Python source code

Move the downloaded archive to a safe location as you may need to recompile Python several times and unzip the file using:

tar -xvzf <file>

3. Check the dependencies

Before installing Python, you might need to install some dependencies, check it before or you might need to recompile everything. If something is missing, you should see it in the compilation logs.

4. Configure the installation

You then need to configure using the command:

./configure --enable-shared --enable-optimizations

Some additional flags might be added if needed.

5. Compile

Finally you can compile using:

make

and then:

sudo make altinstall

6. Additionally

When recompiling, use the following command to clean the installation:

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