网站首页 > python 正文

Centos8安装Python3.9

admin 2024-01-02 10:01:00 python 48 ℃
正文

Centos8安装Python3.9


安装 python 其他相关工具

sudo yum -y install yum-utils

yum -y install ncurses-libs zlib zlib-devel mysql-devel bzip2-devel openssl openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel xz-devel

yum -y install libffi-devel gcc automake autoconf libtool make


2 下载源码包

yum -y install wget vim

wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz

tar -zxvf Python-3.9.13.tgz

cd Python-3.9.13

./configure

make && make install


4 验证

python3 -V

pip3



设置及修改默认python版本

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1

sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.9 1

sudo update-alternatives --config python


设置及修改默认python3版本

sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1

sudo update-alternatives --config python3


python3软连接

sudo ln -s /usr/bin/python3 /usr/bin/python



安装pip和pip3

python -m ensurepip --upgrade

wget https://bootstrap.pypa.io/get-pip.py

python get-pip.py

python3 get-pip.py


更新pip

pip install --upgrade pip

pip3 install --upgrade pip3


本文TAG:

猜你喜欢

蓝色枫叶