Linux下 编译安装安装python3.8.16,为了提高下载速度,采用华为云镜像下载。速度快得很
cd /opt/
下载python3.8
wget https://mirrors.huaweicloud.com/python/3.8.16/Python-3.8.16.tgz
tar -xzvf Python-3.8.16.tgz
mkdir /usr/local/python3
cd Python-3.8.16/
./configure clear
./configure --prefix=/usr/local/python3
make && make install
which pip3
cp /usr/local/python3/bin/pip3 /usr/local/bin/
cp /usr/local/python3/bin/python3 /usr/local/bin/
查看编译效果
/usr/local/python3/bin/python3 --version
查看原来的位置
whereis python3
python3: /usr/bin/python3 /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3.6-config /usr/bin/python3.6m-config /usr/bin/python3.6m-x86_64-config /usr/lib/python3.6 /usr/lib64/python3.6 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/local/python3 /usr/share/man/man1/python3.1.gz
导出原来的包
pip3 freeze >requirements.txt
替换原有python并查看效果
查看原有的python的路径并替换
# whereis python3
python3: /usr/bin/python3.6m /usr/bin/python3.6 /usr/bin/python3 /usr/bin/python3.6-config /usr/bin/python3.6m-config
/usr/bin/python3.6m-x86_64-config /usr/lib/python3.6 /usr/lib64/python3.6 /usr/local/lib/python3.6 /usr/include/python3.6m
/usr/share/man/man1/python3.1.gz
# mv /usr/bin/python3 /usr/bin/python3.6.bak
# ln -s /usr/local/soft/python3.11/bin/python3 /usr/bin/python3
查看原有的pip的路径并替换
# whereis pip3
pip3: /usr/bin/pip3 /usr/bin/pip3.6 /usr/local/bin/pip3 /usr/local/bin/pip3.6 /usr/share/man/man1/pip3.1.gz
mv /usr/bin/pip3 /usr/bin/pip3.bak文章来源:https://www.toymoban.com/news/detail-458368.html
ln -s /usr/local/soft/python3.11/bin/pip3 /usr/bin/pip3文章来源地址https://www.toymoban.com/news/detail-458368.html
到了这里,关于Linux下 编译安装安装python3.8.16的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!