Skip to content

Instantly share code, notes, and snippets.

@StevenMaude
Created April 25, 2021 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenMaude/05b55c3d3a98540daea94adc5ed53bdf to your computer and use it in GitHub Desktop.
Save StevenMaude/05b55c3d3a98540daea94adc5ed53bdf to your computer and use it in GitHub Desktop.
Compiling Python from source on Ubuntu

Basic guide

Pooled together from maybe several place(s) on the web that I can't remember:

sudo apt install libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev tk-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev
./configure --prefix="$SOME_DIRECTORY" --enable-optimizations --with-ensurepip=install

Some additional notes

  • There may be other build dependencies that I already had installed.
  • Check the build log to see if any modules failed to build. If they do, search around to find the build dependencies required.
  • I had an issue while where binascii wouldn't build. This was due to not cleaning the build directory between a failed build and installing more dependencies: make clean fixed this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment