本帖最后由 zhangchenyvn 于 2024-2-13 09:55 编辑
换Debian或Ubuntu,会方便一点。(一条一条地在xterm里执行)
centos7:yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
yum -y install epel-release
yum -y install python-pip
yum -y install wget
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
xz -d Python-3.7.4.tar.xz
tar -xf Python-3.7.4.tar
cd Python-3.7.4
./configure prefix=/usr/local/python3
yum -y install libffi-devel
make && make install
(以下可选执行)
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
vim /etc/profile
export PATH=$PATH:/usr/local/python3/bin
在文件最后添加 export PATH=$PATH:/usr/local/python3/bin
source /etc/profile
O~K~~
选3.7.4的原因是库&函数支持比较好 |