Python环境编译安装

2022/7/13 14:20:16

本文主要是介绍Python环境编译安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1)Python3 下载地址:
wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tar.xz

2)环境编译
yum -y install gcc gcc-c++ patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel

3)python 安装
解压tar.xz 首先需要进行xz 命令安装yum install -y xz
解压:xz -d Python-3.6.10.tar.xz
再次解压:tar -xf Python-3.6.10.tar
mkdir /usr/local/python3.6/
cd Python-3.6.10
./configure --prefix=/usr/local/python3.6/ --enable-optimizatio --with-openssl=/usr/bin/openssl
make -j4
make install

4)建立软件连接生成python3和pip3
ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3
ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip3

5)设置 python3 环境变量
export PATH=$PATH:/usr/local/python3.6/bin/
source /etc/profile


这篇关于Python环境编译安装的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程