1.安装环境
python:python-3.7.4
centos7:CentOS Linux release 7.6.1810 (Core)
2.编译安装
[root@node2 soft]# tar xvf Python-3.7.4.tar.xz && yum install -y readline readline-devel readline-static openssl openssl-devel openssl-static sqlite-devel bzip2-devel bzip2-libs gcc make patch gdbm-devel zlib-devel libffi-devel && cd Python-3.7.4 &&./configure --prefix=/share/python/python3.7 && make && make install && [ $? -eq "0" ] && echo -e "\033[44;37;5m Success \033[0m" || echo -e "\033[47;31;5m Fail \033[0m"
[root@node2 soft]# cd .. && rm -rf Python-3.7.4*
3.指定环境变量
[root@node2 soft]# ln -sf /share/python/python3.7/bin/python3.7 /bin/python3
[root@node2 soft]# ln -sf /share/python/python3.7/bin/pip3 /bin/pip3
[root@node2 soft]# python3
Python 3.7.4 (default, Feb 21 2020, 13:22:00)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
>>> quit()
4.查看编译内容
[root@node2 soft]# cd /share/python/python3.7
[root@node2 python3.7]# ls
bin include lib share
[root@node2 python3.7]# cd bin
[root@node2 bin]# ls
2to3 easy_install-3.7 idle3.7 pip3.7 pydoc3.7 python3.7 python3.7m python3-config pyvenv-3.7
2to3-3.7 idle3 pip3 pydoc3 python3 python3.7-config python3.7m-config pyvenv
————Blueicex 2020/2/21 14:10 [email protected]