看了很多从源码编译的Python 3.10安装方法,但是很多都没有完整写下来安装所需要的系统依赖,所以导致后续使用诸多不便,在此以Debian系为例记录一下:
- 安装依赖:
sudo apt-get install libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev libgdbm-dev libgdbm-compat-dev
- 解压Python3.10的压缩包,进入并安装到/usr/local/python3.10目录下面:
./configure --with-openssl=/usr --enable-optimizations --prefix=/usr/local/python3.10
make
sudo make install
注意,这里的openssl用的是系统自带的,所以openssl的root是/usr