1.在liunx上安装python运行环境
yum -y install gcc
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
2.进入到安装目录
cd /usr/local/
3.下载python3.7的安装包 (可能会有点慢)
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
4.解压安装包
tar -zxvf Python-3.7.0.tgz
5.配置python环境以及安装编译python
1) mkdir /usr/local/python3
2) cd Python-3.7.0
3) ./configure --prefix=/usr/local/python3
4) make && make install
6.确认安装成功
/usr/local/python3/bin/python3.7
会出现:
?? ??? ??? ? Python 3.7.0 (default, Jun ?6 2022, 11:01:13)?
?? ??? ??? ?[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
?? ??? ??? ?Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World!")
Hello World!
>>> exit()
表示安装成功~
?