centos7环境下安装python3

  • 安装依赖
yum install -y openssl-devel openssl-static zlib-devel lzma tk-devel xz-devel bzip2-devel ncurses-devel gdbm-devel readline-devel sqlite-devel gcc libffi-devel
  • 下载Python
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
  • 解压文件
tar -zxvf ./Python-3.7.0.tgz -C /usr/local/Python-3.7.0
  • 编译并安装
./configure --prefix=/usr/local/python3
make && make install
  • 创建软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
  • 测试是否成功
python3 
pip3 list
  • 后台运行Python程序
yum install coreutils # 安装nohub
nohup python -u xxx.py > test.log 2>&1 &
jobs
posted @ 2020-12-18 11:51  huameixiao  阅读(101)  评论(0编辑  收藏  举报