Blog

notebook

Entries for tag "python"

debian 10.13操作系统源码编译安装python3.12.8

服务器以及软件版本

  • debian 10.13
  • python 3.12.8

安装相关依赖

apt-get --allow-releaseinfo-change update
apt upgrade
apt-get install net-tools
apt-get install python3-pip
apt-get install python3-venv
apt-get install pkg-config
apt install wget build-essential libncursesw5-dev libssl-dev \
     libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev 
apt-get install libgdbm-compat-dev liblzma-dev libreadline-dev

增加普通用户,用于源码编译

adduser admin

下载python源码包并编译安装

wget https://www.python.org/ftp/python/3.12.8/Python-3.12.8.tgz
tar zxvf Python-3.12.8.tgz
cd Python-3.12.8
./configure --prefix=/home/admin/python3.12.8 --enable-optimizations
make
make install

创建虚拟环境

python3 -m venv puput_env

激活虚拟环境

source puput_env/bin/activate