How to Install Python 3.10 (or 3.11) on CentOS

发布时间:2023-03-23浏览次数:0

支持注册ChatGPT Plus的OneKey虚拟卡
绑定Apple Pay、Google Pay、支付宝和微信支付进行日常消费

注册和了解更多 ->

silver
  1. Update your system's package index:
sudo yum update
  1. Install the required packages for building Python from source:
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel readline-devel sqlite-devel
  1. Download the source code for Python 3.10 (or 3.11) from the official Python website:
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
  1. Extract the source code:
tar -xf Python-3.10.0.tar.xz
  1. Navigate to the extracted directory:
cd Python-3.10.0
  1. Configure the build:
./configure --enable-optimizations
  1. Compile Python:
make -j $(nproc)

The -j flag specifies the number of CPU cores to use during the compilation process. nproc returns the number of available CPU cores on the system.

  1. Install Python:
sudo make altinstall

The altinstall target installs Python as a separate version, rather than replacing the system's default Python.

  1. Verify that Python is installed and working correctly:
python3.10 --version

This should output the version number of Python 3.10 that you just installed.

字节笔记本扫描二维码查看更多内容