一 安装python
更新Ubuntu软件源和依赖(建议操作)
1-sudo apt update
2-sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
3-下载安装包:
wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tgz
4-解压
tar -xvf /Python-3.10.7.tgz
5-配置并指定安装位置
./configure --with-ssl prefix=/usr/local/python310
6-编译
make
7-安装
sudo make install
二 配载python环境变量
1复制目录
cd /usr/local/python310/bin
sudo cp python3.10 python
sudo cp pip3 pip
2查询path并配置
方式一:sudo cp /usr/local/python39/bin/python /usr/local/bin/python
方式二:sudo vi /etc/profile
#在最后添加,需重启
PATH=/usr/local/python39/bin:$PATH
3检查环境变量
python -v
pip list
pip3 list
标签:python3.10,bin,python,sudo,dev,usr,ubuntu,服务器,local From: https://www.cnblogs.com/likyzhuoerbufan/p/17508220.html