zoukankan      html  css  js  c++  java
  • python3.8、3.9安装

    安装ansible并配置(可选,批量时)

    [root@hdss7-10 ~]# yum -y install epel-release yum-utils
    [root@hdss7-10 ~]# yum -y install ansible
    [root@hdss7-10 ~]# vim /etc/ansible/ansible.cfg
    [defaults]
    inventory = /etc/ansible/hosts
    ask_pass = False
    remote_port = 22
    host_key_checking = False
    remote_user = root
    
    [root@hdss7-10 ~]# vim /etc/ansible/hosts
    [admin]
    172.16.186.10
    [node]
    172.16.186.11
    172.16.186.12
    172.16.186.13
    
    生成秘钥
    [root@hdss7-10 ~]# ssh-keygen -t rsa -P ''
    [root@hdss7-10 ~]# for i in {10..13};do ssh-copy-id root@172.16.186.$i;done
    
    安装pyhton3环境
    [root@hdss7-10 ~]# cat >> 1.sh <<EOF
    #!/bin/bash
    yum -y groupinstall "Development tools"
    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
    wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
    tar -xvJf Python-3.8.2.tar.xz
    cd Python-3.8.2/
    ./configure --prefix=/usr/local/python3
    make && make install
    ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
    python3 -V
    pip3 -V
    EOF
    
    修改1.sh
    [root@hdss7-10 ~]# sh 1.sh
    [root@hdss7-10 ~]# cp 1.sh{,.bak}
    [root@hdss7-10 ~]# sed -i "s/^tar/# tar/" 1.sh.bak
    
    
    发送到其他节点并安装
    [root@hdss7-10 ~]# ansible node -m copy -a "src=/root/1.sh.bak  dest=/root/1.sh mode=0755"
    [root@hdss7-10 ~]# ansible node -m copy -a "src=/root/python-3.8.2.tar.xz  dest=/root/python-3.8.2.tar.xz"
    [root@hdss7-10 ~]# ansible node -m shell -a "sh /root/1.sh"
    

    Python3.9.1 安装

    [root@hdss7-10 ~]# cat /etc/centos-release
    CentOS Linux release 7.9.2009 (Core)
    
    yum -y install epel-release
    
    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 gcc gcc-c++ wget 
    
    wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
    
    tar -zxvf Python-3.9.1.tgz
    
    cd Python-3.9.1
    
    ./configure --prefix=/usr/local/python3.9
    
    make && make install
    
    cat >> /etc/profile << EOF
    export PYTHON_HOME=/usr/local/python3.9
    export PATH=$PYTHON_HOME/bin:$PATH
    EOF
    
    source /etc/profile
    
    [root@hdss7-10 Python-3.9.1]# cd
    
    [root@hdss7-10 ~]# python3.9
    Python 3.9.1 (default, Jan 20 2021, 10:12:02) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    

    Ubuntu 20 安装

    # sudo apt upgrade -y
    sudo apt install -y software-properties-common
    sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
    
    wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
    
    tar -zxvf Python-3.9.1.tgz
    
    cd Python-3.9.1/  
    
    ./configure  --enable-optimizations  --prefix=/usr/local/python3.9
    
    sudo make && sudo make install
    
    sudo vim /etc/profile
    export PYTHON_HOME=/usr/local/python3.9
    export PATH=$PYTHON_HOME/bin:$PATH
    
    source /etc/profile
  • 相关阅读:
    “北斗人”梦想成真!星间链路新技术探索,ThingJS 3D 可视化 效果图
    如何从道路BIM模型中提取数据?分三步超简单!ThingJS 3D 可视化
    ThingJS: 做一个数据可视化项目的难点在什么地方?3D 可视化 three.js
    震撼来袭 | ThingJS 3D城市应用双11钜惠,低至688元>>官方优惠
    ThingJS 和three.js开发有何不同,让开发早点下班回家!3D 可视化
    NASA样本实验室之3D渲染图,和宇航员一样的上帝视角!3D 可视化 ThingJS
    三维建模国内外技术对比:和SketchUp、Revit建模软件相媲美 3D 地图 可视化 ThingJS
    CSS两列及三列自适应布局方法整理
    前端进阶-每日一练(3)
    前端进阶-每日一练(2)
  • 原文地址:https://www.cnblogs.com/smlile-you-me/p/14285608.html
Copyright © 2011-2022 走看看