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
- 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.