个人技术分享

编译 python 3.12

下载 python 源码,执行如下的命令:

export TCLTK_LIBS='-ltk8.6 -ltcl8.6'
export TCLTK_CFLAGS="-I/usr/include/tcl8.6"
./configure  --prefix=/home/charles/install --with-pydebug  --enable-shared --with-openssl=/home/charles/install/ --with-openssl-rpath=auto
make -j2
make install

因为系统预装的openssl 版本低,下载了一个新版本的openssl,然后在 configure 选项里指向安装的地址.

~$ python
Python 3.12.3 (main, May  1 2024, 16:16:21) [GCC 5.5.0 20171010] on linux
Type "help", "copyright", "credits" or "license" for more information.

参考:

Build Python 3.11 From Source With TLS/SSL on CentOS 7 | aikchar.dev