Skip to content

Instantly share code, notes, and snippets.

@danilo-bc
Last active April 17, 2024 13:33
Show Gist options
  • Select an option

  • Save danilo-bc/ff48e1f0fd34818bc2a6e977b5010f0d to your computer and use it in GitHub Desktop.

Select an option

Save danilo-bc/ff48e1f0fd34818bc2a6e977b5010f0d to your computer and use it in GitHub Desktop.
Series of commands to compile a Python version in WSL (2.0), Ubuntu.

Download source from Python.org

https://www.python.org/downloads/source/ e.g., wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz

Extract

tar -xzf Python-3.12.3.tgz

Install deps

sudo apt install build-essential zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev libgdbm-dev liblzma-dev tk-dev lzma lzma-dev libgdbm-dev libgdbm-compat-dev

sudo apt install bison byacc cscope cvs diffstat doxygen flex gettext git indent intltool libtool patch patchutils rcs subversion swig systemtap

Configure

cd Python-3.12.3 ./configure --enable-optimizations --prefix=<optional, leave remove this keyword for system install>

Build

make -j (e.g., 16)

Install

sudo make install

Python should be operational if the install path is in your environment variable (PATH). If not, either add it to the PATH, or go to the respective bin folder and run it.

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