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
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/tech/python/273997.html