通过以下 Referral 链接购买 DigitalOcean 主机,你将可以帮助 V2EX 持续发展
DigitalOcean - SSD Cloud Servers
accgcc233
V2EX  ›  VPS

使用腾讯云轻量服务器安装 python3 环境实现 Python 脚本的执行

  •  
  •   accgcc233 · May 21, 2021 · 1322 views
    This topic created in 1829 days ago, the information mentioned may be changed or developed.
    1. Centos7 环境 Centos7 环境下默认的 python 版本为 python2,故我们要进行编译安装 Python3 ① 安装配置工具 yum -y install wget gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel ② 下载并解压源代码 wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz tar -zxvf Python-3.9.5.tgz ③ 进入目录,编译安装 cd Python-3.9.5 #指定安装目录为 /opt/python39 ./configure --prefix=/opt/python39 #编译安装 make && make install ④ 配置环境变量 vim /etc/profile 在空白处添加如下内容 PATH=/opt/python39/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

    source /etc/profile

    至此,python3 安装完成,可使用 python3 命令打开

    1. Centos8 环境 Centos8 环境下安装 python3 则显得方便许多,可以直接使用 yum 软件包进行安装 yum install -y python38

    安装完成

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3215 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:28 · PVG 21:28 · LAX 06:28 · JFK 09:28
    ♥ Do have faith in what you're doing.