Debian安装Python3.8.5

412次阅读
没有评论
  • 安装相关依赖库
apt install sudo
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev curl -y
  • 下载Python-3.8.5或2.7.5
curl -O https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
curl -O https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.xz
  • 解压Python-3.8.5或2.7.5
tar -xf Python-3.8.5.tar.xz
tar -xf Python-2.7.5.tar.xz
  • 进入安装目录
cd Python-3.8.5/
cd Python-2.7.5/
  • 设置编译参数,
./configure --prefix=/usr/local/python3.8.5 --enable-optimizations
./configure --prefix=/usr/local/python2.7.5 --enable-optimizations
  • 编译及安装
make -j 12 && sudo make altinstall
  • 添加软链接

python3.8.5

sudo ln -s /usr/local/python3.8.5/bin/python3.8 /usr/bin/python3.8
sudo ln -s /usr/local/python3.8.5/bin/pip3.8 /usr/bin/pip3.8

python2.7.5

sudo ln -s /usr/local/python2.7.5/bin/python2.7 /usr/bin/python2.7
  • 查看版本
python3.8 -V
pip3.8 -V
python2.7 -V
正文完
 
Wen' Jian
版权声明:本站原创文章,由 Wen' Jian 2022-12-04发表,共计844字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)