Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Nebuchadrezzar/d87e13f4a7023c0340bd2a2b0c2a552b to your computer and use it in GitHub Desktop.
Save Nebuchadrezzar/d87e13f4a7023c0340bd2a2b0c2a552b to your computer and use it in GitHub Desktop.
Build Python 3.10 on Amazon Linux 2
Download the sources (sqlite 3230100 was broken, 3220000 was used instead):
$ wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
$ wget https://sqlite.org/2018/sqlite-src-3220000.zip
$ wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tar.xz
Move src to /usr/local/src.
$ mv openssl-1.1.0h.tar.gz /usr/local/src/
$ mv sqlite-src-3220000.zip /usr/local/src/
$ mv Python-3.10.4.tar.xz /usr/local/src/
Add paths in your ~/.bashrc or ~/.zshrc so that when you compile python, it'll find the just compiled programs:
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export MANPATH=/usr/local/share/man:$MANPATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
Compile openssl:
$ tar xf openssl-1.1.0h.tar.gz && cd openssl-1.1.0h
$ ./config --prefix=/usr/local/
$ make
$ make test
$ make install
Compile sqlite3:
$ unzip sqlite-src-3220000.zip
$ mkdir sqlite-src-3220000_build && cd sqlite-src-3220000_build/
$ ../sqlite-src-3220000/configure --prefix=/usr/local --disable-tcl
$ make
$ make install
Compile python:
$ tar xf Python-3.6.5.tar.xz && cd Python-3.6.5/
$ ./configure --prefix=/usr/local/ --enable-optimizations
$ make
(Ensure that 'make' found both ssl and sqlite libraries.)
$ make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment